All exceptions descend from the java.lang.Throwable superclass : Exception « Statements « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Statements » Exception 
5.11.1.All exceptions descend from the java.lang.Throwable superclass
import java.io.File;

public class MainClass {
  public static void main(String[] argv) {
    File myFile = new File(".");

    try {
      System.out.println("About to call.");
      myFile.getCanonicalFile();
      System.out.println("Call succeeded.");
    }

    catch (Throwable xceptn) {
      System.out.println("File stress! " + xceptn.getMessage());
      xceptn.printStackTrace();
    }

    System.out.println();
  }
}
About to call.
Call succeeded.
5.11.Exception
5.11.1.All exceptions descend from the java.lang.Throwable superclass
5.11.2.Declaring Exceptions
5.11.3.Java has two kinds of exception: checked and runtime.
5.11.4.Runtime Exceptions descend from RuntimeException class
5.11.5.Objects of type Error are not Exception objects
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.