You can Only execute one class at one time from the command line and in your program there are two classes which have main method if you run Second class at one time then it will not execute the main method of the Third class and vice versa. I have tested it on my system.