public class GetterSetterExample { private int age = 10; private String name; @Override public String toString() { return String.format("%s (age: %d)", age, name); } public int getAge() { return age; } public void setAge(int age) { this.age = age; } protected void setName(String name) { this.name = name; } }