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
What are jpa repositories?
How do you find lambda?
What is java lang noclassdeffounderror?
Why do we create dto in java?
Which is more secure: java or activex? : java security
Can we extract main method from another class?
What is a cookie in java?
Who created eclipse?
What is gui in java with examples?
Does jvm maintain a cache by itself? Does the jvm allocate objects in heap? Is this the os heap or the heap maintained by the jvm? Why
What is a stream in programming?
How do I install java on windows?
What is spliterator in java se 8?
Why oracle type 4 driver is named as oracle thin driver?
What is resultsetmetadata in java?