int[] myIntArray = new int[10]; ... myIntArray = new int[3];
In C and C++, there will be a memory leak.
In Java, when an object is not being referenced anymore, it is eligible for garbage collection.