Answer:
in the code snippet below, c. When System.out.println(a2) is executing, the toString() method is called.
d. When System.out.println(a1) is executing, the toString() method in class A gets called.
Explanation:
public class Test{
public static void main(String[] args){
Object a1 = new A();
Object a2 = new Object();
System.out.println(a1);
System.out.println(a2);
}
}
class A{
int x;
@Override
public String toString(){
return "A's x is " + x;
}
}