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 jvm?
Is java singleton thread safe?
What do you understand by numeric promotion?
Why is javac not recognized?
What is aop java?
What is the use of flatmap in java 8?
Does ms edge support java?
What is jar file in java?
What is mime in java?
What is lambda expressions action func and predicate?
Name primitive java types.
What is transactional in java?
How do I install jdk?
What is scrollable resultset in java?
Write a program using call by refernce for two different classes to explain to print whether a given number is automorphic or not.