karellism
2/15/2019 - 8:35 AM

Declaration of Arrays in Java

2 ways how you can declare an Array in Java.

int intArray[]; //Declaring Array
intArray = new int[20];  //Allocating Memory To Array

int[] intArray = new int[20]; //Combining Both Statements In One Line

int[] intArray = new int[]{ 1,2,3,4,5,6,7,8,9,10 }; //Declaring A Literal Array