Question
This is about the accessibility of members with different access modifiers in Java. Select the two statements below that are correct. - Data hiding is
This is about the accessibility of members with different access modifiers in Java.
Select the two statements below that are correct.
- Data hiding is supported by declaring all instance variables and instance methods private.
- Generally you should declare instance variables as public and instance methods as private.
- Instance variables that are to be accessible via inheritance, only to the subclasses (in any package) of the defining class, should be declared as private.
- Instance variables that are to be accessible via inheritance, only to the subclasses (in the same package) of the defining class, should have no access modifier stated.
- There are exactly four levels of access in java.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started