Results 1 to 5 of 5
- 01-01-2009, 12:15 PM #1
Member
- Join Date
- Dec 2008
- Posts
- 17
- Rep Power
- 0
Constructors, Setter & Getter << need some explaining
Hi everyone,
I'm a new 2 java programming, I've started study it 2 months ago in my college (Computer Science) ..
I've a problem with Setter & Getter, they're not clear !
when I use them ? and why ? (with some examples plz)
I hope anyone help me ,,
(Sorry about my bad English) :D
- 01-01-2009, 12:37 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
- 01-01-2009, 12:49 PM #3
Member
- Join Date
- Dec 2008
- Posts
- 17
- Rep Power
- 0
thanks Eranga,
But what's the difference if I use any method and in its end I write return Value ?
- 01-01-2009, 12:53 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
In simple word it's all about encapsulation, safety for the code from others change. You are get the input from the setter method and return the values from getter, and all the processing done on different methods. Normally those methods have higher restriction in access, private in most of the cases.
- 01-01-2009, 01:03 PM #5
Member
- Join Date
- Dec 2008
- Posts
- 17
- Rep Power
- 0
Similar Threads
-
problem in getter method
By freddieMaize in forum Advanced JavaReplies: 5Last Post: 05-26-2008, 08:02 AM -
Help with constructors
By Minime in forum New To JavaReplies: 3Last Post: 04-09-2008, 08:59 AM -
Initializing variables using constructors
By Java Tip in forum Java TipReplies: 0Last Post: 01-13-2008, 09:28 PM -
constructors
By khamuruddeen in forum New To JavaReplies: 2Last Post: 12-01-2007, 04:15 PM -
How To Add Fields And Generating Getter-Setters
By JavaForums in forum NetBeansReplies: 0Last Post: 07-31-2007, 12:13 AM
Bookmarks