This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Hiding fields in constructor and setter methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Hiding fields in constructor and setter methods" Watch "Hiding fields in constructor and setter methods" New topic
Author

Hiding fields in constructor and setter methods

Kah Tang
Ranch Hand

Joined: Sep 10, 2007
Posts: 58
I'm having a question about hiding fields in setter methods and constructors. I know hiding fields is not according to Sun code standards, but is it really not permitted to use it in constructors and setters?

I now have something like


Before, I had some ide generated code like:


Personally, I prefer the ide generated version.
What do you think?
[ July 26, 2008: Message edited by: Kah Tang ]
Eric Chou
Greenhorn

Joined: Jul 23, 2008
Posts: 20
I agree with you, I always use the second form
Jethro Borsje
Ranch Hand

Joined: Jul 22, 2008
Posts: 100
I also always use the second form, I think hiding is not a problem in this case, but for the SCJD I am not sure.


SCJP, SCJD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hiding fields in constructor and setter methods
 
Similar Threads
pass bean property values to javascript function
jsp:setProperty error
should not contain any special characters
Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
Object Creation in Static Method