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

Write a program to print 15 random numbers using foreach of java 8?

549


Why is java logo a cup of coffee?

627


What is constant in programming?

560


What is bubble sort in java?

621


How do you declare a variable?

631






What is array and arraylist in java?

535


What are the different ways to handle exceptions?

543


What is cr keyboard?

659


Where are local variables stored?

513


How an object is serialized in java?

534


Differentiate storage classes on the basis of their scope?

676


Is empty list java?

527


What is finalize() function in java?

563


Is oracle java 11 free?

533


How do you initialize an arraylist in java?

513