aboutsummaryrefslogtreecommitdiff
path: root/usage_examples/GetterSetterExample_post.jpage
blob: b0921b861177ccd0e55dd4ec679dad70c04af5bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
	}
}