Return to site

JAVA CERTIFICATION QUESTION: Accessing public, private, protected, and default classes in Java

February 19, 2022

Java’s four access control levels increase accessibility from private to default (which has no keyword), then to protected, and then to public.

Given the following:

 

And:

 

Which line, when inserted individually at line n1, compiles successfully? Choose one.

A. obj.drive();

B. drive();

C. Compilation of the obj.stop();

D. Compilation of the stop();

 

 

 

 

 

 

·ꓭ uoᴉʇdo sᴉ ɹǝʍsuɐ ʇɔǝɹɹoɔ ǝɥꓕ ·uoᴉsnʅɔuoꓛ