throw someThrowableObject;
Example:
public Object pop() throws EmptyStackException { Object obj; if (size == 0) throw new EmptyStackException(); obj = objectAt(size - 1); setObjectAt(size - 1, null); size--; return obj; }
When a dynamic linking failure or some other "hard" failure in the virtual machine occurs, the virtual machine throws an Error.
The RuntimeException class represents exceptions that occur within the Java virtual machine (during runtime).
Copyright © 1998-2009 Dilvan Moreira