Skip to content

Commit 4480496

Browse files
committed
insert element in new array dynamically
1 parent 2187504 commit 4480496

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Basic programs/arrayInsert.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package BasicPractice;
2+
3+
import java.util.ArrayList;
4+
5+
public class arrayInsert {
6+
7+
public static void main(String[] args) {
8+
9+
int[] arr = { 4, 3, 2, 7 };
10+
11+
ArrayList<Integer> list = new ArrayList<Integer>();
12+
13+
// inserting
14+
for (int i = 0; i < 3; i++) {
15+
list.add(i + 10);
16+
}
17+
System.out.println(list);
18+
}
19+
20+
}

0 commit comments

Comments
 (0)