Thank you very much for your explanation, swati.
Guoqiao
Originally posted by swati bannore:
HI,
It's simple..do not get confused...
Private variables are accessible for a class in which it is declared..
Private variables can NOT be accessed/seen from the subclass or from any other package or from within a package..
So..lets see an example..
in the above code, since a1 , a2 are objects of BankAccount class..can freely access all the variables of that class ,including private variables...it's like they are two childs of One parent..
Guoqiao Sun<br />SCJP2 SCWCD2<br />Creator of <a href="http://www.jiris.com/" target="_blank" rel="nofollow">www.jiris.com</a>, Java resource, mock exam, forum