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
What is the difference between overriding & overloading?
Can you give few examples of final classes defined in java api?
What is meant by class and object in java?
What is the purpose of static methods and static variables?
What about static nested classes in java?
How can you traverse a linked list in java?
What is passing by reference in java?
How a string is stored in memory?
Is overriding possible in java?
What is supplier in java?
When is the arraystoreexception thrown?
Which class should you use to obtain design information about an object in java programming?
What is data and its types?
What is literal example?
What are the different tags provided in jstl?