Program to handle the exception hierarchies in Java
class Animal extends Exception {
}
class Mammel extends Animal {
}
public class Human {
public static void main(String[] args) {
try {
throw new Mammel();
} catch (Mammel m) {
System.err.println("It is mammel");
}
}
}
Output:
It is mammel
