We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 542c967 + 748f139 commit af7068cCopy full SHA for af7068c
ArrayList.java
@@ -0,0 +1,23 @@
1
+import java.util.*;
2
+public class ArrayList
3
+{
4
+ public static void main(String[] args) {
5
+ Scanner sc =new Scanner(System.in);
6
+
7
+ // creating a ArrayList object
8
+ ArrayList<Integer> arr = new ArrayList<Integer>();
9
+ int n=10;
10
+ for(int i=0;i<=5;i++){
11
+ // add element and taking input
12
+ arr.add(sc.nextInt());
13
+ }
14
+ //print all elememt
15
+ System.out.println(arr);
16
+ //remove the 4th index elemet
17
+ arr.remove(4);
18
19
+ //acessing the element by index -->method get(i)
20
+ System.out.println(arr.get(2));
21
22
23
+}
0 commit comments