Q:

Method having parameter "exception handling class objects" in java

Dear friends I am beginner to exception handling in java. I got this sample from one tutorial and I run this code its printed Arithmetic exception. If I remove that method which is have parameter as ArithmeticException then the first method called that is print Exception. 
   Please any one can explain what is happening with this code.
public class Question1 {

  public static void javaHungry(Exception e) {
    System.out.println("Exception");
  }

  public static void javaHungry(ArithmeticException ae) {
    System.out.println("ArithmeticException");
  }

  public static void javaHungry(Object obj) {
    System.out.println("Object");
  }

  /**
  * @param args
  */
  public static void main(String[] args) {
    javaHungry(null);
  }

}

A:

When you overload methods and passed a parameter which suits for all, the most specific methods can be choose at run time.
The order of specificiation here is 
ArithmeticException  > Exception  > Object 

1) If you remove method with ArithmeticException it chooses Exception.
2) If you remove method with Exception it chooses Object.  

