Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {
    static void aMethod() {
        try {
            throw new NullPointerException("demo");
        } catch (NullPointerException e) {
            System.out.println("Caught inside demoproc.");
            throw e; // rethrow the exception
        }
    }

    public static void main(String args[]) {
        try {
            aMethod();
        } catch (NullPointerException e) {
            System.out.println("Recaught: " + e);
        }
    }
}