public class X implements Z {
public String toString() {
return "I am X";
}
public static void main(String[] args) {
Y myY = new Y();
X myX = myY;
Z myZ = myX;
System.out.println(myZ);
}
}
class Y extends X {
public String toString() {
return "I am Y";
}
}
interface Z {}
What is the reference type of myZ and what is the type of the object it references?
If you want to solve the questions together with the experts and understand the concepts better, please contact us using the contact form or WhatsApp numbers. Selected people get to do that without any additional charges.