Menu

Questions 1 3 Reference Following Code 1 Select Declarations Would Cause Compile Error 2 S Q43831142

For Questions 1-3 reference the following code:

interface Iface { public boolean m(); public int n(); class A implements Iface { public String s; public String x; public boo

1. Select all of the declarations below that would NOT cause acompile error:

Iface i1 = new A(); B b = new Iface(); O A a1 = new B(); Iface i2 = new Iface(); o A a2 = new A();

2. Select all of the declarations below that would NOT cause acompile error:

O lface i1 = new A(); String val1 = i1.s; lface i2 = new B(); String val2 = 12.x; O A a1 = new A(); String val3 = a1.s; O A a

3. What would be printed when the main method is executed?

class Q3 { A a1 = new A(); boolean val1 = a1.m(); Iface i1 = new B(); int val2 = 11.n(); Iface i2 = a1; int val3 = 12.n(); pu

interface Iface { public boolean m(); public int n(); class A implements Iface { public String s; public String x; public boolean m() { return true; public int n() { return 12; class B implements Iface { public String s; public String y; public boolean m() { return false; public int n() { return 2; Iface i1 = new A(); B b = new Iface(); O A a1 = new B(); Iface i2 = new Iface(); o A a2 = new A(); O lface i1 = new A(); String val1 = i1.s; lface i2 = new B(); String val2 = 12.x; O A a1 = new A(); String val3 = a1.s; O A a2 = new A(); String val4 = a 2.y; class Q3 { A a1 = new A(); boolean val1 = a1.m(); Iface i1 = new B(); int val2 = 11.n(); Iface i2 = a1; int val3 = 12.n(); public static void main(String[] args){ Q3 q = new Q30); System.out.println(q.val1 + “, ” + q.val2 +”, ” + q.val3); O false, 2, 12 false, 12,2 O O false, 12, 12 O true, 2, 2 O true 2, 12 true 2, 12 O true, 12,2 Show transcribed image text interface Iface { public boolean m(); public int n(); class A implements Iface { public String s; public String x; public boolean m() { return true; public int n() { return 12; class B implements Iface { public String s; public String y; public boolean m() { return false; public int n() { return 2;
Iface i1 = new A(); B b = new Iface(); O A a1 = new B(); Iface i2 = new Iface(); o A a2 = new A();
O lface i1 = new A(); String val1 = i1.s; lface i2 = new B(); String val2 = 12.x; O A a1 = new A(); String val3 = a1.s; O A a2 = new A(); String val4 = a 2.y;
class Q3 { A a1 = new A(); boolean val1 = a1.m(); Iface i1 = new B(); int val2 = 11.n(); Iface i2 = a1; int val3 = 12.n(); public static void main(String[] args){ Q3 q = new Q30); System.out.println(q.val1 + “, ” + q.val2 +”, ” + q.val3); O false, 2, 12 false, 12,2 O O false, 12, 12 O true, 2, 2 O true 2, 12 true 2, 12 O true, 12,2

Expert Answer


Answer to For Questions 1-3 reference the following code: 1. Select all of the declarations below that would NOT cause a compile e…

OR