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 |
What is jboss in java?
What is csrf in java?
What is interceptor in java?
What are the risks in java security? : java security
Can the main method be overloaded?
What is an entity in java?
Is it better to learn java or python?
What is predicate in lambda expression?
Name primitive java types.
program A and B are analysed and found to have worst case running time greater than 150NlogN and N*N respectively. which program has the better guarantee after the running time for the large values of N(N>10000)? which program has the better guarantee for the running time of small program N (N<100)? which program will run faster on average for N=1000?
0 Answers St. Pauls University,
Explain suspend() method under thread class>
How do I enable jvm?