As @mwilki7 stated above JVM can only execute one main() to run, but you can call the other main() as you would call any other method in java.
To put it simply:
- You cannot have multiple classes with same names in the same package.
- Even if you have different names for both the classes with main() in them, JVM will only call the main() of one particular class, the class you specify while running
java <class name>on the command line.
Here is a StackOverflow question regarding this topic: Can there exist two main methods in a Java program?
Hope this helps you :)