Question: Analyze the following code: public class Test{ public static void main(String] args) { B b = new B(); b.m(5); System.out.println(i is + b.i); class
![Analyze the following code: public class Test{ public static void main(String]](https://s3.amazonaws.com/si.experts.images/answers/2024/08/66d2e28e954fd_59066d2e28e23331.jpg)
Analyze the following code: public class Test{ public static void main(String] args) { B b = new B(); b.m(5); System.out.println("i is " + b.i); class A int i; public void m(int i) { this.i = i; class B extends A{ public void m(String s) { The program has a runtime error on b.i, because i is not accessible from b. The method m is not overridden in b. Binherits the method m from A and defines an overloaded method m in b. The program has a compilation error, because b.m(5) cannot be invoked since the method m(int) is hidden in The program has a compilation error, because mis overridden with a different signature in B
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
