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
How do I install java on windows?
What is an actionevent in java?
Can we write lambda without functional interface?
How can I write a program that takes command line input?
Is java singleton thread safe?
Is eclipse a jdk?
What is ui framework in java?
Do I need both jdk and jre?
What is the difference between java se and java ee?
Can a method be static and synchronized?
What is custom tag in java?
What is hql in java?
Why bean class is used in java?
What is the difference between swing and awt components?
In hibernate what is the difference between the Session and SessionFactory?