What happens when a main method is declared as private?

Answer Posted / pawan

vani, varsha is correct , the 'private main method' is as
good as any member method your class can have (note that
main is not a key word in java) , it can be only used inside
the class in which it is defined.

It is clearly mentioned in the specifications that the
executing class should contain a 'public static void method'
as a point of execution otherwise execution will fail
complaining ABOUT THE METHOD WHICH I MENTIONED ABOVE.

Is This Answer Correct ?    2 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is core java important?

568


What is the synonym of framework?

554


Can a serialized object be transferred via network?

508


Assume a thread has lock on it, calling sleep() method on that thread will release the lock?

613


How do I convert a numeric ip address like 192.18.97.39 into a hostname like java.sun.com?

594






What is a variable and constant?

539


Why we used break and continue statement in java?

547


Explain the importance of thread scheduler in java?

588


What exceptions occur during serialization?

596


String and stringbuffer both represent string objects. Can we compare string and stringbuffer in java?

537


What are the elements of java?

545


What is garbage collector?

612


What are the five major types of reference sources?

523


What is listnode in java?

526


Explain the use of javap tool.

623