Which two modifications, made independently, enable the…

Given the code fragment:

Which two modifications, made independently, enable the code to compile?

Given the code fragment:

Which two modifications, made independently, enable the code to compile?

A.
Make the method at line n1 public.

B.
Make the method at line n2 public.

C.
Make the method at line n3 public.

D.
Make the method at line n3 protected.

E.
Make the method at line n4 public.



Leave a Reply 3

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


Snr DingDong

Snr DingDong

Answer is C & D.

Overriding method needs to have same or more accessible access modifier than that in its Super class.
ie in order for a public method to be overridden the overriding method must be public. protected or public works for a protected method as in this question. etc etc

smh

smh

with your answer line 4 will not compile