Given the following definition of a class, which fields are accessible from outside the package com.corporation.project ?
package com.corporation.project; public class MyClass { int i; public int j; protected int k; private int l; }
Select the two correct answers.
Field i is accessible in all classes in other packages.
Field j is accessible in all classes in other packages.
Field k is accessible in all classes in other packages.
Field k is accessible in subclasses only in other packages.
Field l is accessible in all classes in other packages.
Field l is accessible in subclasses only in other packages.
How restrictive is the default accessibility compared to public , protected , and private accessibility?
Select the one correct answer.
Less restrictive than public .
More restrictive than public , but less restrictive than protected .
More restrictive than protected , but less restrictive than private .
More restrictive than private .
Less restrictive than protected from within a package, and more restrictive than protected from outside a package.
Which statement is true about accessibility of members ?
Private members are always accessible from within the same package.
Private members can only be accessed by code from within the class of the member.
A member with default accessibility can be accessed by any subclass of the class in which it is defined.
Private members cannot be accessed at all.
Package/default accessibility for a member can be declared using the keyword default .