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
Why is core java important?
What is the synonym of framework?
Can a serialized object be transferred via network?
Assume a thread has lock on it, calling sleep() method on that thread will release the lock?
How do I convert a numeric ip address like 192.18.97.39 into a hostname like java.sun.com?
What is a variable and constant?
Why we used break and continue statement in java?
Explain the importance of thread scheduler in java?
What exceptions occur during serialization?
String and stringbuffer both represent string objects. Can we compare string and stringbuffer in java?
What are the elements of java?
What is garbage collector?
What are the five major types of reference sources?
What is listnode in java?
Explain the use of javap tool.