Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hiding fields in constructor and setter methods

 
Kah Tang
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with you, I always use the second form
 
Jethro Borsje
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!