-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemo1.java
More file actions
29 lines (24 loc) · 696 Bytes
/
Demo1.java
File metadata and controls
29 lines (24 loc) · 696 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
import java.util.ArrayList;
import java.util.Collections;
public class Demo1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
ArrayList list = new ArrayList();
list.add(99999);
list.add(1000); // add at End
list.add(2000);
//list.add("amit");
//list.add(0,"ram");
System.out.println(list);
System.out.println("Size is "+list.size());
//list.remove(1);
System.out.println(list);
System.out.println(list.get(0)); // list[0]
boolean isFound = list.contains("tom");
System.out.println(isFound);
//list.set(0, "Mike");
System.out.println("After Set "+list);
Collections.sort(list);
System.out.println("After Sort "+list);
}
}