1.

Why Doesn't The Main Method Throw An Error With No Arguments?

Answer»

When you INVOKE the Java Virtual Machine on a class WITHOUT any arguments, the class' main method receives aString array of zero length. Thus, the method SIGNATURE is fulfilled. Provided the main method does not make any reference to ELEMENTS in the array, or checks the array length before doing so, no EXCEPTION will occur.

When you invoke the Java Virtual Machine on a class without any arguments, the class' main method receives aString array of zero length. Thus, the method signature is fulfilled. Provided the main method does not make any reference to elements in the array, or checks the array length before doing so, no exception will occur.



Discussion

No Comment Found