permaculture playing cards*
The moose likes Beginning Java and the fly likes encapsulation question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "encapsulation question" Watch "encapsulation question" New topic
Author

encapsulation question

auvrm papu
Ranch Hand

Joined: Sep 01, 2005
Posts: 105
My friend asked me this question to resolve..
can anyone help finding the answer with the reason



Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30057
    
149

What do you think? Are there any you can rule out? Maybe they don't compile? Or show poor encapsulation? Have you looked up the definition of encapsulation yet?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
auvrm papu
Ranch Hand

Joined: Sep 01, 2005
Posts: 105
i thought it would be choice 2, but not sure
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3816

auvrm papu wrote:i thought it would be choice 2, but not sure

First try compiling them and see as Jeanne suggested.
Rajeev Trikha
Ranch Hand

Joined: Jan 29, 2010
Posts: 85
Edited to remove answer.


Rajeev Trikha (SCJP 6)
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please see DoYourOwnHomework.

And others, please *allow* people to do their own homework.
Siddhesh Deodhar
Ranch Hand

Joined: Mar 05, 2009
Posts: 117
Second one is the best example for encapsulation.


Good, Better, Best, Don't take rest until, Good becomes Better, and Better becomes Best.
Sidd : (SCJP 6 [90%] )
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

 
Consider Paul's rocket mass heater.
 
subject: encapsulation question
 
Similar Threads
hashCode() doubt
Why autoboxing doesnt work here???
Thread question
Using THIS
Threas - Object Locks Question