MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

/*
 * Output:
 * 
 * recaught: java.lang.NullPointerException: demo 
 *  
 */
public class MainClass {
    public static void main(String args[]) {
        try {
            throw new NullPointerException("demo");
        } catch (NullPointerException e) {
            System.out.println("recaught: " + e);
            e.printStackTrace();
        }
    }
}