In Java why we write public static void main(String args[])
why not main()?
Answer Posted / pandurang d billavar
for execution of class in java is done by creating a object
for methods of that class.so main method is also a class
method.so this method is called by jvm directly without
creating object for main method.it is possible only if main
is static.............so we maked main as static.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is a finally block? Is there a case when finally will not execute?
What is main in java?
What is the hashcode () and equals () used for?
What steps are taken when the OS shifts from one-thread execution to another?
What is the difference between Grid and Gridbaglayout?
What is return data type?
What is type safety in java?
Can you extend singleton class?
Define a package.
Can a static class have a constructor?
What restrictions are placed on method overriding?
Are primitives objects?
Define an abstract class with reference to java.
What are the application of stack?
What is difference between == and === in js?