class X {
public void f( ) { System.out.print("1"); }
public static void g() { System.out.print("2"); }
}
class Y extends X{
public void f( ) { System.out.print("3"); }
}
class Z extends Y {
public static void g( ) { System.out.print("4"); }
}
public class num23 {
public static void main(String args[]) {
X obj = new Z( );
obj.f( );
obj.g( );
}
}
obj.f(): Call f( ) in class Z, call f( ) in class parent and output 3
obj.g(): Call g( ) of class Z and output 4
Output result: 34
I solved it in the same format as above, and the answer was 32.
If so
java
© 2024 OneMinuteCode. All rights reserved.