
Play Store Application link – https://play.google.com/store/apps/details?id=com.ideepro.java25hours
Learn with youtube video-
💡Definition-
array is a collection of similar type of elements.
It’s a static data Structure. //fixed size
Index of array starts from zero to size-1.
Phases of object creation-
| Concept | Description | Example |
|---|---|---|
| Declaration | Creating a reference variable that can hold a value of a specific data type | int[] arr; |
| Instantiation | Creating an actual array object in memory using the new operator | arr = new int[10]; |
| Initialization | Assigning values to the elements of the array using a loop, array literal, or method such as Arrays.fill() | arr[i] = i; or int[] arr = {1, 2, 3, 4, 5}; or Arrays.fill(arr, 0); |
1- Declaration– (Datatype and reference variable)
2-Instantiation– (memory allocation of certain size)
3-Initialization- (giving values into allocated memory)
💡(i)1-D Array
Case1–💡
dataType arrRef []; //declaration
arrrRef=new dataType[size]; //instantiation
arrRef [zero] to arrRef [size-1] = someValue; //initialization
Case2-💡
dataType arrRef []=new dataType[size]; // declaration & instantiation
arrRef [zero] to arrRef [size-1] = someValue; //initialization
Case3-💡
*dataType arrRef []={ Value1, Value2……,ValueN }; //declaration,instatiation,initialization
💡(ii) Multidimensional
![multi-dimensional-array-in-java[1]](https://corejava25hours.com/wp-content/uploads/2021/02/multi-dimensional-array-in-java1.jpg)
Ex-
int [][] arr=new int [3][3]; //3 row and 3 column
arr[0][0]=1; to arr[2][2]=n;
OR
int arr[][]={{1,2,3},
{2,4,5},
{4,4,5}};
Code samples are here
1-d array in case 1
package Array; import java.util.Arrays; public class ExArr1Case1 { public static void main(String[] args) { int[] abc; abc = new int[5]; abc[0] = 3; abc[1] = 7; abc[2] =12; abc[3] =9; abc[4] =2; System.out.println(Arrays.toString(abc)); } }
2- 1-d array in case 2
package Array; import java.util.Arrays; public class ExArr1Case2 { public static void main(String[] args) { int[] abc = new int[5]; abc[0] = 3; abc[1] = 7; abc[2] =12; abc[3] =9; abc[4] =2; System.out.println(Arrays.toString(abc)); } }
package Array; import java.util.Arrays; public class ExArr1Case3 { public static void main(String[] args) { int[] abc ={3, 7, 12, 9, 2}; System.out.println(Arrays.toString(abc)); } }
package Array; import java.util.Arrays; public class ExArr2Case1 { public static void main(String[] args) { int[][] abc; abc = new int[2][3]; abc[0][0] = 3; abc[0][1] = 7; abc[0][2] = 12; abc[1][0] = 9; abc[1][1] = 2; abc[1][2] = 10; System.out.println(Arrays.deepToString(abc)); } }
package Array; import java.util.Arrays; public class ExArr2Case2 { public static void main(String[] args) { int[][] abc = new int[2][3]; abc[0][0] = 3; abc[0][1] = 7; abc[0][2] = 12; abc[1][0] = 9; abc[1][1] = 2; abc[1][2] = 10; System.out.println(Arrays.deepToString(abc)); } }
package Array; import java.util.Arrays; public class ExArr2Case3 { public static void main(String[] args) { int[][] abc ={{3, 7, 12},{9, 2, 10}}; System.out.println(Arrays.deepToString(abc)); } }
Interview Questions —
- what is array ?
- Can we instantiate array without assigning size ?

![one-dimensional-array-in-java[1]](https://corejava25hours.com/wp-content/uploads/2021/02/one-dimensional-array-in-java1.jpg)


















Think twice before clicking this web address which is a proven scam and automated tools have identified this server as a central hub for credential harvesting operations so bookmark trusted official portals directly instead of trusting links found in public comment sections.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
**mitolyn reviews**
Mitolyn is a carefully developed, plant-based formula created to help support metabolic efficiency and encourage healthy, lasting weight management.
[…] Step 19: Java Arrays Explained – Easy Guide with Code (12th Hour)Step 20: Java String Handling Explained – Easy Guide with Code (13th Hour)Step 21: Proven Java Learning Path – Collection Frameworks Made Simple with Code (14th + 15th Hour) […]
Your article helped me a lot, is there any more related content? Thanks!
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
This app is awesome