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 java lang?
Can we install jre without jdk?
What is gpt and gpc? : java security
What is @override annotation in java?
Can a dead thread be started again?
What is stateless class in java?
What is use of jpa?
Is java built on c?
Define network programming?
What is hql in java?
How do I enable java in firefox?
Are streams faster than for loops?
What is meant by rest api in java?
What is the use of servlet in java?
What is static class in java?