0
What is meaning of that code
public void set color(string c) { this.color=c; } }
5 odpowiedzi
+ 6
it's used for giving control accessing to variable... it's only accessible by its public method and other can't access them
+ 4
it's a java setter method. whenever You call this method u hv to set value to ur variable mention inside method and it's easy way to assign value.
+ 1
That's a setter.
To get a better understanding of setters and getters, read here: https://stackoverflow.com/a/2036991
0
wy we have to use set and get method
0
thanku