What is the need to declare main() method as static in Java?
Answer Posted / bsridhar1984
main() is the entry point of the java program for JVM. If it
is not static and have to call main method, JVM has to
create the object for that class. At this situation
constructor of that class will be entry point.
So that main() method of that class should be static. Then
only JVM can access the main method directly without
creating object of the program.
| Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
What is a uint8?
Is java an api?
What is stateful in java?
What is meant by annotations in java?
What is rxjava2?
What is loose coupling in java?
How should I format my code? How should I comment my code?
Can I have multiple main methods in the same class?
What is a stream in java?
How do I install eclipse?
Explain the inheritance principle.
What is native api in java?
Why is struts used in java?
What is the meaning of loosely coupled in java?
Is jdk required for netbeans?