If a variable is declared as private, where may the variable be accessed

A private variable may only be accessed within the class in which it is declared.

Showing Answers 1 - 3 of 3 Answers

It may be accessed in any of the methods defined in that class. Generally for the security of the variables we declare them as private and using the public methods in the class we use them. Makinng sure that variables are accessible only in that class

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions