Question: Analyze the following code: class A{ final int x = 5; static int y = 5; } class B extends A{ final int x =
Analyze the following code: class A{ final int x = 5; static int y = 5; } class B extends A{ final int x = 4; static int y = 4; } class C { public static void main(String[] args) { B b = new B(); System.out.println("x is "+b.x+" and y is "+b.y); } } O Program compiles and prints "x is 4 and y is 4" Program compiles and prints "x is 4 and y is 5" Program has a compilation error O Program compiles and prints "x is 5 and y is 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
