Skip to content

Commit 467a8ca

Browse files
authored
Update 2021-11-27-add-element-in-arraylist.md
1 parent 79473b1 commit 467a8ca

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

_posts/collections/arraylist/2021-11-27-add-element-in-arraylist.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
---
1+
---
22
layout: post
33
title: "How To Add An Element To ArrayList In Java?"
44
author: gaurav
55
categories: [Collections, ArrayList]
66
toc: true
7-
description: "In this article, we will see how to add element in ArrayList. Also, we will see how can we add an element at particular index in ArrayList."
7+
description: "In this article, we will see how to add an element in ArrayList. Also, we will see how we can add an element at a particular index in ArrayList."
88
---
99

10-
In this article, we will see how to add an element in [ArrayList](https://coderolls.com/arraylist-in-java/). Also, we will see how can we add an element at particular index in ArrayList.
10+
In this article, we will see how to add an element in [ArrayList](https://coderolls.com/arraylist-in-java/). Also, we will see how we can add an element at a particular index in ArrayList.
1111

1212
## Introduction
1313

@@ -29,7 +29,7 @@ This method appends the specified element `e` to the end of the list.
2929

3030
This method returns `true` if the element is added to the list otherwise, it returns `false`.
3131

32-
Let's see a java program to add an element to the list using the above method.
32+
Let's see a Java program to add an element to the list using the above method.
3333

3434
```java
3535

@@ -83,7 +83,7 @@ This method adds the specified element `element` at the specified index `index`.
8383

8484
This method has a return type as `void` so, it will not return anything.
8585

86-
Below, we will see a java program to add an element at the specified index in ArrayList.
86+
Below, we will see a Java program to add an element at the specified index in ArrayList.
8787

8888
```java
8989
import java.util.ArrayList;
@@ -103,7 +103,7 @@ public class ArrayListAddExample {
103103

104104
ArrayList<String> arrayList = new ArrayList<String>();
105105

106-
//adding elements to the arrayList using normal add method
106+
//adding elements to the arrayList using the normal add method
107107
arrayList.add("Gaurav");
108108
arrayList.add("Shyam");
109109

@@ -125,12 +125,12 @@ Output:
125125

126126
## Conclusion
127127

128-
We can add element to the [ArrayList](https://coderolls.com/arraylist-in-java/) using `add()` method in two ways.
128+
We can add an element to the [ArrayList](https://coderolls.com/arraylist-in-java/) using the `add()` method in two ways.
129129
1. `add(E e)` - It will add an element to the end of the ArrayList
130-
2. `add(int index, E element)`- This method will add an element at the specified index
130+
2. `add(int index, E element)`- This method will add an element to the specified index
131131

132132
---
133133

134-
The example java programs given in the above tutorial can be found at [this GitHub Repository](https://github.com/coderolls/blogpost-coding-examples/tree/main/collections/arraylist/add-element-in-arraylist).
134+
The example Java programs given in the above tutorial can be found at [this GitHub Repository](https://github.com/coderolls/blogpost-coding-examples/tree/main/collections/arraylist/add-element-in-arraylist).
135135

136-
If you know any other ways, you a can write a comment below.
136+
If you know of any other ways, you can write a comment below.

0 commit comments

Comments
 (0)