Visibility in explicit way: private, protected, public, or default (package). Se
ID: 3714921 • Letter: V
Question
Visibility in explicit way: private, protected, public, or default (package).
Select the best choices for (7) where there are two answers.
A. Applicable to inner classes
B. Accessible only to members of the class in which it is declared.
C. Visible to classes in this package
D. Visible to classes outside the package that extend this class.
E. Visible to all classes.
F. Visible only within this class
G. Visible to all classes where the class defining the member must also be public.
Java visibility Applied to Classes esApplied to Class Members Visibility efauo package() Public Protected PrivateExplanation / Answer
A. Default is the access specification applicable to inner classes and classes
B. The private access specification can be used with Members and default with classes, if we want the members of the class to be accessible only inside the class in which they are declared.
C. Default should be applied to class and public should be applied to members if we need a class to be visible to all classes inside a package.
D. Protected access specification for methods and public acces specification for class if we want a class to be accessible in another class that extends it globally
E. Public to class and public to members needed if classes and members are to be accessible to all classes
F. Visibility only in the same class requires a class to be private and members to be private
G. Pbblic access specification should be applied to both class and members as the members and class must be visible to all classes
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.