0
Show a program to highlight getters and setters?
with comments !!
2 Answers
+ 1
privateString myField;
publicString getMyField(){
//include validation, logic, logging or //whatever you like here
returnthis.myField;
}
publicvoid setMyField(String value){ //include more logic
this.myField = value;
}
0
dhanyavaad bete