Which methods can access to private attributes of a class?
Answers
Answered by
6
Answer:
Methods, Variables and Constructors that are declared private can only be accessed within the declared class itself. Private access modifier is more secure and restrictive access level, whereas class and interfaces cannot be private.
Answered by
0
Answer:
Explanation:
- Declared private methods, variables, and constructors can only be accessed within the declared class.
- The private access modifier provides a more secure and controlled level of access, whereas classes and interfaces are not private.
- Private variables can only be accessed from outside the class if the class has public getter methods.
- The private modifier object isolates itself from the rest of the world and limits access to it.
#SPJ2
Similar questions
English,
4 months ago
Math,
4 months ago
English,
11 months ago
Computer Science,
11 months ago
Math,
11 months ago