We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6ebd896 commit 1d5cf20Copy full SHA for 1d5cf20
Lists/ArrList.java
@@ -0,0 +1,29 @@
1
+import java.util.List;
2
+import java.util.ArrayList;
3
+public class ArrList{
4
+ public static void main(String [] args)
5
+ {
6
+
7
+ User me = new User();
8
+ me.setFirstName("Omar");
9
+ me.setLastName("Belkady");
10
11
12
+ User you = new User();
13
+ you.setFirstName("Nour”);
14
+ you.setLastName("Abouham");
15
16
+ //Remember uppercase User is the type. The you is the name of the
17
+ //variable
18
+ //When working with lists where we have to put a generic type
19
+ //We can use the custom type. This is a custom type of type User
20
+ List<User> users = new ArrayList<User>();
21
+ //To append I use .add and I add the custom type user
22
+ users.add(you);
23
+ users.add(me);
24
25
+ //To access
26
+ System.out.println(users.get(1).getFullName());//1=me
27
28
+ }
29
+}
0 commit comments