Skip to content

Commit 5574a7e

Browse files
committed
feat: Person 클래스 정의
값 객체여서 불변객체로 선언
1 parent 4d97946 commit 5574a7e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package table;
2+
3+
public class Person {
4+
5+
private final int id;
6+
private final String name;
7+
private final String address;
8+
9+
public Person(int id, String name, String address) {
10+
this.id = id;
11+
this.name = name;
12+
this.address = address;
13+
}
14+
15+
public void printPersonInfo() {
16+
System.out.println(
17+
"ID: " + this.getId() + " / 이름: " + this.getName() + " / 주소: " + this.getAddress());
18+
}
19+
20+
public int getId() {
21+
return id;
22+
}
23+
24+
public String getName() {
25+
return name;
26+
}
27+
28+
public String getAddress() {
29+
return address;
30+
}
31+
}

0 commit comments

Comments
 (0)