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 blank final variable?

569


What is array and arraylist in java?

535


What is the difference between char and char *?

569


What is an escape character in java?

538


Can private class be extended java?

571






How is garbage collection controlled?

738


Why is stringbuffer thread safe?

572


Can a function return a function?

555


Write a function for palindrome and factorial and explain?

661


What is hashmap in java?

573


How many bytes are there?

544


Difference between doublesummarystatistics, intsummarystatistics and longsummarystatistics ?

555


What is the difference between class forname and new?

552


What is the difference between replace and replace all?

479


What are autoboxing and unboxing? When does it occur?

536