When something goes wrong in Java, an exception object is thrown up the call stack until a handler catches it—or the thread stops and prints a stack trace. Java uniquely splits exceptions into checked (enforced by javac) and unchecked (programming bugs or bad inputs).
More lessons in Complete Core Java