-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray_List.java
More file actions
37 lines (33 loc) · 938 Bytes
/
Array_List.java
File metadata and controls
37 lines (33 loc) · 938 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
import java.util.*;
public class Array_List {
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
ArrayList<Integer> list=new ArrayList<>();
System.out.println(list);
list.add(0);
list.add(677);
list.add(3);
list.add(9999);
int max=-999;
// System.out.println(list);
// list.add(1,1);
// System.out.println(list);
// System.out.println(list.get(2));
// list.remove(0);
// System.out.println(list);
// list.set(3,899);
// System.out.println(list);
// System.out.println(list.contains(20));
// for(int i=list.size()-1;i>=0;i--){
// if(max<list.get(i)){
// max=list.get(i);
// }
// }
// System.out.println(max);
System.out.println(list);
Collections.sort(list);
System.out.println(list);
Collections.sort(list,Collections.reverseOrder());
System.out.println(list);
}
}