How many of them (a.i, a.j, a.k, b.i, b.j and b.k) can be pr…
How many of them (a.i, a.j, a.k, b.i, b.j and b.k) can be printed in the question mark area? [ans] Click to Show Image Description Left code block package p1; public class A { int i = 5; private int j = 10; protected int k = 15;} Right code block package p2; import p1.*; public class B extends A { public static void main(String[] args) { A a = new A(); B b = new B(); System.out.println(?); }}
Read DetailsWhich one is correct? Click to Show Image Description Left…
Which one is correct? Click to Show Image Description Left code block public class P { int i = 5; int j = 20; public int getI() { return i; } public static void main(String[] args) { P p = new C(); System.out.println(p.getI() + “,” + p.getJ()); }} Right code block public class C extends P { int i = 10; int j = 15; public int getJ() { return j; }}
Read Details