What happens when a main method is declared as private?

Answer Posted / srinivasa

JVM is also a program. If main() is declared as privateit
is not available outside of that class . So JVM through the
exception.

Is This Answer Correct ?    15 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a memory leak in java?

515


What are the 4 types of characters?

521


What is the base class of all exception classes in java?

548


Difference between object and reference?

656


How are this() and super() used with constructors in java programming?

540






What is the static keyword?

566


Can we use return in constructor?

470


If you do not want your class to be inherited by any other class. What would you do?

538


What is the purpose of final keyword and when to use it?

504


What is continuity of a function?

499


What is runtime polymorphism or dynamic method dispatch?

499


In java, how many ways you can take input from the console?

490


What is singleton class example?

561


What is sizeof () operator?

552


What is token in java?

507