-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerson.java
More file actions
55 lines (44 loc) · 1.02 KB
/
Person.java
File metadata and controls
55 lines (44 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
*/
public class Person
{
public String name;
public String phone;
public String address;
public Person()
{
// default constructor
}
public Person(String name, String phone, String address)
{
this.name = name;
this.phone = phone;
this.address = address;
}
public String getName() {
return name; // returns name
}
public String getPhone() {
return phone; // return phone
}
public String getAddress() {
return address; // return address
}
public void setName(String name) {
this.name = name; // set name
}
public void setPhone(String phone) {
this.phone = phone; // set phone
}
public void setAddress(String address) {
this.address = address; // set address
}
public String toString()
{
return "Name: " + name + ",\n Phone: " + phone + ",\n Address: " + address;
}
public void print()
{
System.out.println(toString());
}
}