getter/setter java code example
Example 1: java setter
public setValue(value) {
this.value = value;
}
Example 2: getter setter
public class Person {
private String name; // private = restricted access
// Getter
public String getName() {
return name;
}
// Setter
public void setName(String newName) {
this.name = newName;