public class TestMain {
public static void methodTest(Exception e) {
System.out.println("Exception method called");
}
public static void methodTest(Object e) {
System.out.println("Object method called");
}
public static void methodTest(NullPointerException e) {
System.out.println("NullPointerException method called");
}
public static void main(String args[]) {
methodTest(null);
}
}
Output: NullPointerException method called