Practice mode Java

What access level does a Java class member have when no access modifier is written?

Correct answer C. Package-private, visible only within its package

Explanation

Leaving out the modifier gives package access, so only code in the same package can use the member. It is more restrictive than protected, because a subclass in another package cannot reach it. Note that this default applies to class members only, since members of an interface are implicitly public.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

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

Links and website addresses are not allowed in comments.