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
Which interceptor is responsible for setting action javabean properties?
Which is faster c++ or java?
What is jpa implementation?
What is profile in java?
In a barber shop there are 2 doors. customer come in 1 door, leave in other. minimum # of chairs. barber spend his life in cutting. always barber can cut 1 customer. few chairs in the shop. if barber busy customer waits, if chairs full, customer leave. if no customer, barber sleeps. treat barber and customer as 2 threads. you can use Semaphore class with arrive and depart and count as parameter.
What is stateless class in java?
What is native class in java?
how can we create the ui using netbeans,having the code?
what about jdb and javadoc by example ?
What is java language expression?
What is an actionevent in java?
Is java installed on windows 10?
What is an interceptor in java?
What are the rules regarding quotation marks?
What is the difference between deep copy and shallow copy in java