class A {
String s1 = "A.s1"; String s2 = "A.s2";
void t1(){
System.out.println("IN CLASS A");
}
}
class B extends A {
String s1 = "B.s1";
String s2 = "B.s2";
//String s12 = "B.s12";
void t1(){
System.out.println("IN CLASS B");
System.out.print(super.s1);
}
public static void main(String args[]) {
B x = new B(); A y = (A)x;
A z = new B();
System.out.println(x.s1+" "+x.s2+" "+y.s1+" "+y.s2);
System.out.println(z.s1+" "+z.s2);
z.t1();
}
}
output:
this might be silly but please figure out what will be the output of the given code snippet...and please explain it.
thanks in advance.