0
can anyone explain getter and setter in detail..i am not able to understand plzz..??
5 Antworten
+ 1
getter is the term used for functions which return some value. setter is used to set values to variables.
in order to prevent unauthorized modification to values of variables, we restrict this access in these functions.
this thing comes under encapsulation concept.
syntax :
public int getAttribute();
public void setAttribute(int data);
0
Yaaa
0
Itss a jst common
0
Like getter so u would b able to get any valu to d prgm whereas setter for set a value to the variable which we has apply
0
Consider the example of a Money class that has a getValue() method on it that returns the "value" in dollars.