public class A {
public void f(A a) {
System.out.print("in A ");
}
}
public class B extends A {
public static void main(String[] args) {
B b = new B();
A a = new A();
b.f(b);
b.f(a);
}
}
Why by adding the following method in B class there will be a compilation error?
It's known that if method throws something, it doesn't have to be declared in the method header...
public void f(A a) {
System.out.println("in B");
throw new java.io.IOExeption();
}