method throw an error with no arguments?
When you invoke the Java Virtual Machine on a class without any arguments, the class’ main method receives a String 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.
Related Questions
- We can declare methods that throw an exception (or error) of unknown type. Example (of method with type parameter in throws clause): interface Task< E extends Exception > { void run() throws E ; } Can such a method throw an object of the unknown exception (or error) type?
- Why doesn the main() method throw an error with no arguments?
- method throw an error with no arguments?