Let say we have the following two different methods to declare array:
// Method 1
int[] myArray = new int[10];
// Method 2
int myArray[] = new int[10];
What do the following parts do internally when we creating an array?
Part 1:
int[] myArray
Part 2:
int myArray[]
and Part 3:
new int[10]
And what is the importance of []
in case of creating an array? And what is the difference between int[] myArray
and int myArray[]
method while creating an array?