Consider the following code . what is the result of compiling & executing C.java ?
class A { }
class B extends A { }
class C extends B {
static void doSomething ( A x , A y ) {System.out.print("AA");}
static void doSomething ( A x , B y ) {System.out.print("AB");}
static void doSomething ( B x , A y ) {System.out.print("BA");}
static void doSomething ( B x , B y ) {System.out.print("BB");}
static void doSomething ( C x , C y ) { System.out.println("CC");}
public static void main(
String[] args) {
doSomething(null,null);
}
}
Options :
a . Prints AA to the console
b . Prints AB to the console
c . Prints BA to the console
d . Prints BB to the console
e . Prints CC to the console
The correct answer is e
Can anyone explain me.