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
Is jdk required for netbeans?
What is java net url?
What is @resource annotation in java?
What is flatmap in rxjs?
Does ms edge support java?
What happens when the parent process of a child process exits before the child ?
What is transient in java?
What is the use of entity class in java?
Is java built on c?
Explain the inheritance principle.
Why is lambda expression used?
What is singleton pattern in java?
What are the advantages of java 8’s date and time api over old date api and joda time api?
What is the use of lambda functions?
Explain working of java virtual machine (jvm)?