aboutsummaryrefslogtreecommitdiff
path: root/usage_examples/GetterSetterExample_post.jpage
blob: b99ba7e18fd6746a3eea02024e6d5849883e3726 (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)", name, age);
	}
	
	public int getAge() {
		return age;
	}
	
	public void setAge(int age) {
		this.age = age;
	}
	
	protected void setName(String name) {
		this.name = name;
	}
}