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 transient in java?
How do I export a java project?
What is transactional in java?
Why is javac not recognized?
Can the main method be overloaded?
What is jpa used for?
In java what is the difference between sleep() and wait() .
What is the use of flatmap in java 8?
Can we use lambda without functional interface?
What is tuple2?
What is property file in java?
What is java api?
What is the meaning of loosely coupled in java?
Does netbeans need jdk?
What is java ioc?