What is the need to declare main() method as static in Java?
Answers were Sorted based on User's Feedback
Answer / juhi
If main method is static it should not be able to access any
other methods(other than static methods). but this is not
the case y?
| Is This Answer Correct ? | 1 Yes | 0 No |
We know very well that when we want to call any method without creating Class object in which that method is reside,this will
be perform by "static" keyword.And in java main()always call by JVM,So we can call main()without instance create with the help of jvm.Therefore we needed static with main();
INTERNALLY MAIN()CALL WITH THE HELP OF TRY-CATCH BLOCK
try{
ClassName.main();
}
catch(Exception e)
{
---------------
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Explain different way of using thread?
What is servlets.
What are the advantages of java 8’s date and time api over old date api and joda time api?
What's the difference between authentication and authorization? : java security
What is reflection in java?
How do I export a java project?
How do I run a java project in netbeans?
What are the advantages of java sockets?
What is cookie in java?
What does el mean in java?
Please tell what are frames,pannel,container,jframe,jpannel and what are there relation?
Is lambda cheaper than ec2?