Java ArrayList

LEELA S
Mar 17, 2022

--

ArrayList class is a resizable array which is present in the java.util packages.

Array vs ArrayList

In array, the size of the array cannot changed.If we want to add or remove items from an array,you have to create a new one.

In ArrayList,We can modify the size of the elements whenever we want.

Syntax

1)Add Items

Output

[Leela, Pooja, jo, Proksh, Pranavi]

2)Access an element

Output

Leela

3)Change an item

Output

[Amu, Pooja, jo, Proksh, Pranavi]

4)Remove an item

Output

[Pooja, jo, Proksh, Pranavi]

5)ArrayList Size

Output

5

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

LEELA S
LEELA S

No responses yet

Write a response