Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
> > > > > > CountInstances ref = new CountInstances(); > > > > Ref may be, as it is in this case, an instance of the CountInstances class. However, this is not why it has access to the private method. It has access to the private method because it is being called within the class CountInstances (yes, that's right the method main is actually part of the CountInstances class.) Should a similiar instance (ref2) be created in a completely different class then then a call such as ref2.getNumInstances() would not be allowed.
Replies: |
Sponsored Links
|