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

Answer Posted / pranab dutta

No the program fails to compile, if you have multiple main
methods in the same class. The compiler says that the main
method is already defined in the class.

Is This Answer Correct ?    18 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an empty class? What functionality does it offer in Java?

679


what is the constructor and how many types of constructors are used in java?

539


What do you mean by Function Overloading in java?

635


What are the java ide’s?

577


Explain covariant method overriding in java.

546






How to display all the prime numbers between 1 and n (n is the number, get the input from user)

516


What is hash in java?

523


What is the use of protected in java?

537


Which way a developer should use for creating thread, i.e. Sub classing thread or implementing runnable.

524


Explain the reason behind ending a program with a system.exit(0)?

602


Difference between error and exception

5030


What is the difference between static and non-static variables in java programming?

523


Which is bigger float or double?

522


Can java program run without jre?

573


Explain the differences between abstraction and encapsulation?

525