Two Laptop Bag*
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30795
    
157

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: 3838

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: 118
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

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: encapsulation question