What is the need to declare main() method as static in Java?

Answer Posted / kuldeep vishwakarma

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between loosely coupled and tightly coupled in java?

517


What is an api in java?

577


What is resultsetmetadata in java?

577


What is lambda used for?

545


What is transactional in java?

610






What is the difference between the boolean & operator and the && operator?

600


How do you type the lambda symbol?

562


What is stateful in java?

576


What is transient in java?

559


What is data encapsulation?

613


What is ibatis in java?

584


What's a code group? : java security

605


What is the difference between Logical Parallelism and Physical Parallelism?

3033


I have deployed a .war file in my application server comprising of struts and hibernate.If i want to change the "dialect" property of hibernate cfg file how can i change(I have only .war file)... Thanks in advance

1506


What are messages in java?

550