GeeCON Prague 2014*
The moose likes Mock Exam Errata and the fly likes Roundup #208 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "Roundup #208" Watch "Roundup #208" New topic
Author

Roundup #208

Gil Salu
Greenhorn

Joined: Nov 10, 2000
Posts: 6
could someone clearify #208?
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
You know, I didn't memorize that one.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Paul Caudle
Ranch Hand

Joined: Jun 08, 2000
Posts: 64
I think perhaps this question might fit well in the Java Ranch forum or maybe we could just get one of the Sheriffs to clarify what #208 is...or we can run the game until we get it...that's what I think I'll do in the meantime.
Paul
Paul Caudle
Ranch Hand

Joined: Jun 08, 2000
Posts: 64
Can one object access a private variable of another object of the same class?
<h6>it only took me about 2 minutes to find it...but I got a lot of the questions wrong in the meantime</h6>
The answer to this question is Yes, it can. I think the explanation of this answer in the round-up is that the access is granted to the class, not the object...
To explain that a little further, any object created from a specific class has access to the private variables of any other object created from that class.
Take a look:

Even though there are 2 different objects here (referenced using x and b) b is still able to access the private variable of object x. Why? Because the objects referenced by x and b were both created from the same class (Sharing), and objects created from the same class have access to each other's privates ( get your mind out of the gutter, you know what I mean!).
I hope that helps...send me an e-mail if you want a little clarification and I'll post it up here.


[This message has been edited by Paul Caudle (edited November 13, 2000).]
Gil Salu
Greenhorn

Joined: Nov 10, 2000
Posts: 6
Thanks all...after I re-read the question I understood what it was talking about...
 
Consider Paul's rocket mass heater.
 
subject: Roundup #208