Given:
class A {
int a = 5;
String doA() { return “a1”; }
protected static String doA2 () { return “a2”; }
}
class B extends A {
int a = 7;
String doA() { return “b1”; }
public static String doA2() { return “b2”; }
void go() {
A myA = new B();
System.out.print(myA.doA() + myA.doA2() + myA.a);
}
public static void main (String[] args) { new B().go(); }
}
Which three values will appear in the output?
A.
5
B.
7
C.
a1
D.
a2
E.
b1
F.
b2
I’d wish to consider your answers, because on my opinion and test I have in ouput: b1 a2 5
Fixed. Thanks Boris.
I agree with Boris, output is: b1 a2 5
D, E, A