Skip to content

Commit 2d530a6

Browse files
authored
Update arraylist.md
Added the changes
1 parent 9dcea22 commit 2d530a6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lessons/arraylist.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ section: "Arrays"
66
description: "learn arrays"
77
---
88
## ArrayList in java
9-
<hr>
109
The ArrayList class is in implementation of the list interface that allow us to create resizable array. In simple term we can say that ArrayList in java is dynamic array for storing the elements.
1110
It is just like the vector in c++.
1211

@@ -67,7 +66,7 @@ The ArrayList class have some methods to perform different operations on arrayli
6766
- Change elements
6867
- Remove elements
6968

70-
## Add Elements :
69+
### Add Elements:
7170
- add() : This is the method to insert any elements at the end of the list.
7271
```java
7372
import java.util.ArrayList;
@@ -86,7 +85,8 @@ class Main {
8685
}
8786
}
8887
```
89-
## Output
88+
### Output:
89+
9090
```
9191
ArrayList : [Virat,Dhoni,Sachin]
9292
```
@@ -114,7 +114,7 @@ class Main {
114114
}
115115

116116
```
117-
## Output
117+
### Output:
118118
```
119119
ArrayList : [Virat,Dhoni,Sachin];
120120
Dhoni
@@ -126,7 +126,7 @@ import java.util.ArrayList;
126126

127127
class Main {
128128
public static void main(String[] args) {
129-
ArrayList<String> languages = new ArrayList<>();
129+
ArrayList<String> playerName = new ArrayList<>();
130130

131131
// add() method without the index parameter
132132
playerName.add("Virat");
@@ -141,7 +141,7 @@ class Main {
141141
}
142142
}
143143
```
144-
## Output
144+
### Output:
145145
```
146146
ArrayList : [Virat,Dhoni,Sachin]
147147
New ArrayList : [Virat,Dhoni,Rohit]
@@ -154,7 +154,7 @@ import java.util.ArrayList;
154154

155155
class Main {
156156
public static void main(String[] args) {
157-
ArrayList<String> animals = new ArrayList<>();
157+
ArrayList<String> playerName = new ArrayList<>();
158158

159159

160160
// add() method without the index parameter
@@ -172,7 +172,7 @@ class Main {
172172
}
173173
}
174174
```
175-
## Output
175+
### Output:
176176
```
177177
ArrayList : [Virat,Dhoni,Sachin]
178178
New ArrayList : [Virat,Dhoni]

0 commit comments

Comments
 (0)