What happens when a main method is declared as private?
Answer Posted / dharma
main method signature must be like
public static void main(String args[])
if we declare as private then it compiles successfully
but at Runtime it says
"Main method not found in class"
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is an exception in java?
How to stop a thread in java? Explain about sleep () method in a thread?
What is java thread dump, how can we get java thread dump of a program?
What is the primitive type short?
In Java list the methods that can be overridden?
Is null a keyword in java?
What is public/private protected in java?
Explain the private protected method modifier?
Can you give few examples of final classes defined in java api?
What does the string method compareto () do?
Can an interface implement another interface?
What is static keyword in java?
Are primitives objects?
What is the difference between replace and replace all?
Does constructor be static?