Computer Science, asked by beantkaurluthra9141, 9 months ago

Which methods can access to private attributes of a class?

Answers

Answered by Anonymous
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 ashutoshmishra3065
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