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

What is difference between static class and singleton pattern?

561


What is the difference between an array and an array list?

600


What is console based application in java?

660


Difference between static and dynamic class loading.

665


Can sleep() method causes another thread to sleep?

663






write a program that list all permutations of ABCDEF in which A appears before B?

2116


Why hashcode is used in java?

595


Is jdk required on each machine to run a java program?

877


Difference between stack and queue?

666


What is Session reduplication and how its done?

1658


What is a data structure java?

599


Compare java and python.

667


What is a conditional statement explain with example?

629


How to sort list of list in java?

752


What is close method? How it's different from Finalize & Dispose?

650