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 do I need to install netbeans?
What happens when the parent process of a child process exits before the child ?
What type of parameter passing does java support?
What is a container in java?
What is transactional in java?
What are anonymous methods and lambda expression?
Which is best framework in java?
What is the front end for java?
Why do we only use the main method to start a program?
What do you understand by numeric promotion?
What is native api in java?
What is phantom memory?