Suppose I have the following classes
class A{
    public method(A a) {
        System.out.println(3);
    }
}
class B extends A{
  public void method (A a) {
        System.out.println(2);
  }
  public void method (B b) {
        System.out.println(1);
  }
}
A obj = new B();
obj.method( (B) obj);
((B) obj).method( (B) obj);
The first method call prints out 2 while the second method call prints out 1. Why don't both method calls print out 1?
 
     
     
     
    