I declared an array as shown below:
int[] arr = new int[10];
Then I assigned following values to the array:
arr[0] = 1;
arr
Java arrays are actually fixed in size, and the other answers explain how .length isn't really doing what you'd expect. I'd just like to add that given your question what you might want to be using is an ArrayList, that is an array that can grow and shrink:
https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html
Here the .size() method will show you the number of elements in your list, and you can grow this as you add things.