Nilesh Dutta

@goodboi (1)
How do I make multiple classes and name them in java?
posted to Ask by JavasLava

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 :)

I would like help in java
posted to Ask by studentTylerTy1

I'd like to help but what qualifies as qualified information :(

🐶Introduce yourself! 🐶
posted to Announcements by katyadee

Hey all.. Just here to get together, make some cool programs and friends in the way :)