Is there is any error if you have multiple main methods in
the same class?

Answer Posted / srikanth

No, there is no error if we have multiple main methods
in the same class.
because, while compiling we only specify one main method
name so, the JVM compiles it by taking the main method which
is specified by us while compiling.

Is This Answer Correct ?    3 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where is core java used?

765


What is complexity and its types?

715


What do you mean by singleton class in java?

681


how would you implement a thread pool? : Java thread

676


What does it mean that a method or field is “static”?

711


What is the main purpose of serialization in java?

766


What is the difference between the final method and abstract method?

764


Explain jdk, jre and jvm?

757


What is the tradeoff between using an unordered array versus an ordered array?

909


What is a conditional equation?

763


What is pass by value?

704


What is the difference between the direct buffer and non-direct buffer in java?

773


Define jit compiler?

832


Why is singleton class used?

763


What is the difference between a switch statement and an if statement?

744