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
Can interface be private in java?
What is an immutable object? How do you create one in java?
What is a finally block?
Explain abstract class in java?
What is an inner class in java?
What is the difference between the font and fontmetrics classes in java programming?
Is a boolean variable?
What is the difference between variable & constant?
String and stringbuffer both represent string objects. Can we compare string and stringbuffer in java?
How do you create a sop?
Can a class have multiple subclasses?
How do you check whether the list is empty or not in java?
What is preparedstatement in java?
Explain all java features with real time examples
Why do we need singleton?