Throw Exception through main method : Main « Language « Java Tutorial






public class MainClass {
  public static void main(String[] args) throws Throwable {
    try {
      throw new Throwable();
    } catch (Exception e) {
      System.err.println("Caught in main()");
    }
  }
}








1.7.Main
1.7.1.The Method main
1.7.2.Throw Exception through main method
1.7.3.New parameter for main method
1.7.4.Display all command-line arguments.