javasocketsmultiprocessing

Can an application having two main methods running individually be considered a multi-process application?


I've implemented a simple chat application in java using sockets following the client-server architecture, where both the client and the server classes have main methods of their own. Will these two run as two separate processes or just one?


Solution

  • There can be only 1 Main function running in an app process. If both classes are compiled in the same app, having their own Main functions present in their code does not mean they will actually be run, unless you tell Java to run them. But, if you are compiling the classes as separate apps, then they will run as separate processes.