-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContact.java
More file actions
29 lines (24 loc) · 921 Bytes
/
Contact.java
File metadata and controls
29 lines (24 loc) · 921 Bytes
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
//generates contact instances
public class Contact {
private String firstName;
private String lastName;
private String phoneNumber;
//constructor
public Contact(String first, String last, String phoneNumber) {
this.firstName = first;
this.lastName = last;
this.phoneNumber = phoneNumber;
}
//getters
//
public String getFirstName() {return firstName;}
public String getLastName() {return lastName;}
public String getPhoneNumber() {return phoneNumber;}
public Object[] getContactObjectArray() {return new Object[] {firstName,lastName,phoneNumber};}
//stringing the instance by formal presentation rules separated by tabs.
public String toString()
{
String str= firstName + "\t" + lastName + "\t" + phoneNumber; // "name lastname phonenumber"
return str;
}
}//end of class