public class HelloThere {
public static void main(String[] args) {
System.out.println("Hello " + args[0]);
}
}
Suppose it's run like this:% java HelloThere
Notice that's there's no args[0]
.
Here's what you get:
% java HelloThere java.lang.ArrayIndexOutOfBoundsException: 0 at HelloThere.main(HelloThere.java:5)This is not a crash. The virtual machine exits normally. All memory is cleaned up. All resources are released.