Skip to content

Instantly share code, notes, and snippets.

@karellism
Last active February 28, 2019 12:33
Show Gist options
  • Save karellism/7db1d278ed6cf607be5968073e730e0f to your computer and use it in GitHub Desktop.
Save karellism/7db1d278ed6cf607be5968073e730e0f to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment