forked from yfain/Java4Kids_code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyContacts.java
More file actions
38 lines (27 loc) · 969 Bytes
/
Copy pathMyContacts.java
File metadata and controls
38 lines (27 loc) · 969 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
30
31
32
33
34
35
36
37
38
package solutions;
import java.util.ArrayList;
/**
* Created by NewProgrammer on 3/28/15.
*/
public class MyContacts {
public static void main(String[] args) {
ArrayList<ContactDetail> friends = new ArrayList<>();
ContactDetail friend1 = new ContactDetail();
friend1.setFullName("Jackie Allen");
friend1.setEmail("jallen@gmail.com");
friend1.setFacebookID("jallen");
friend1.setPhone("212-545-5545");
ContactDetail friend2 = new ContactDetail();
friend2.setFullName("Art Jones");
friend2.setEmail("ajones@gmail.com");
friend2.setFacebookID("ajones");
friend2.setPhone("212-333-2121");
friends.add(friend1);
friends.add(friend2);
friends.forEach(friend -> System.out.println(friend));
/* an old way to loop through a collection
for (ContactDetail friend: friends){
System.out.println(friend);
}*/
}
}