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

Answer Posted / nisha

The compilation error, if you have multiple main
methods in the same class.
Error like :java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: Uncompilable source
code - main(java.lang.String[]) is already defined

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is arraylist zero based?

544


What are selection structures?

527


What is the difference between a vector & an array list?

663


What is connection class in java?

499


What is a class variable?

556






What is the most important feature of java? What is an interface?

505


What is a method signature java?

562


Explain java thread life cycle.

574


What is the protected method modifier?

556


What is the difference between I ++ and ++ I in java?

500


What is the benefit of inner classes in java?

594


What are the advantages of autoboxing?

527


What are bind parameters?

537


Write a program to calculate factorial in java?

575


What is regex used for?

533