Commit be34c11
committed
feat: Demonstrate basic usage of ArrayList with user input in Java
🧠 Logic:
- Creates an `ArrayList<Integer>` with initial capacity of 5.
- Takes 5 user inputs and stores them in the list using `add()`.
- Prints each element using `get(index)` since array-style indexing doesn't apply to ArrayList.
- Shows example usages (commented): `contains()`, `set()`, `remove()`, and printing the list.
Signed-off-by: Somesh diwan <[email protected]>1 parent 8b6efd6 commit be34c11
1 file changed
+2
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | | - | |
35 | 36 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | 37 | | |
40 | 38 | | |
0 commit comments