How do you initialize an array variable in java program?

Java

1 answer

Answer

1105078

2026-08-04 19:45

+ Follow

Java
Java

An array in Java is a collection of items stored into a single unit. The array has some number of slots (elements), each slot in the array can hold an object or a primitive value. Arrays in Java are objects that can be treated just like other objects in the language

Arrays can contain any type of element value , but we can't store different types in a single array. We can have an array of integers or an array of strings or an array of arrays.

To create an array in Java ,use three steps

1. Declare a variable to hold the array

2. Create a new array object and assign it to the array variable

3. Store things in that array

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.