Which four code fragments, inserted independently at line 7, will compile?

Given:

2. public class Hi {
3. void m1() { }
4. protected void() m2 { }
5. }
6. class Lois extends Hi {
7. // insert code here
8. }

Which four code fragments, inserted independently at line 7, will compile? (Choose four.)

Given:

2. public class Hi {
3. void m1() { }
4. protected void() m2 { }
5. }
6. class Lois extends Hi {
7. // insert code here
8. }

Which four code fragments, inserted independently at line 7, will compile? (Choose four.)

A.
public void m1() { }

B.
protected void m1() { }

C.
private void m1() { }

D.
void m2() { }

E.
public void m2() { }

F.
protected void m2() { }

G.
private void m2() { }



Leave a Reply 0

Your email address will not be published. Required fields are marked *