
Patrick B. answered 09/06/20
Math and computer tutor/teacher
much of the code is missing...
in particular the class A and anything after that...
Sarah P.
asked 09/05/20Predict what will be printed out on console, if you run class 'Test' below?
public class Test {
public static void main(){String[] a){
A ref = new B();
ref.mP();
}
}
protected int f = 1;
public void mP(){
System.out.println("100");
mQ();
mR();
}
public void mQ(){
System.out.println(f);
mR();
}
private void mR(){
System.out.println(f);
}
}
public class B extends A {
protected int f = 2;
public void mP(){
System.out.println("101");
super.mP();
}
public void mQ(){
System.out.println(f);
super.mQ();
}
public void mR(){
System.out.println(f);
}
}
public class A {
Patrick B. answered 09/06/20
Math and computer tutor/teacher
much of the code is missing...
in particular the class A and anything after that...
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.