1.

I Get An Exception If I Remove The Static Modifier From Main?

Answer»

The static void main(String[]) method is a basic convention of the Java programming language that provides an entry POINT into the runtime system. The main method MUST be DECLARED static because no OBJECTS exist when you first invoke the Java Virtual Machine (JVM), so there are no references to instance methods. The JVM creates the initial runtime environment in which this static method can be called, if you remove the static modifier, it will throw aNoSuchMethodException.

The static void main(String[]) method is a basic convention of the Java programming language that provides an entry point into the runtime system. The main method must be declared static because no objects exist when you first invoke the Java Virtual Machine (JVM), so there are no references to instance methods. The JVM creates the initial runtime environment in which this static method can be called, if you remove the static modifier, it will throw aNoSuchMethodException.



Discussion

No Comment Found