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 - 2 of 2 Answers

Anonymous

  • Jun 7th, 2012
 

I understand your question to be pertaining to private variables w/in a class and not local variables (i.e. variables declared w/in a method). That said, a private variable may be accessed by constructors and methods declared w/in the class AND may also be accessed by inner classes defined w/in the class.

  Was this answer useful?  Yes

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