I'm currently experimenting with initializing an array of objects, and came across the following two approaches of filling the array of objects:
Approach 1
Cat[] catArray = new Cat[num]
for (int i = 0; i < num; i++) {
Cat someCat = new Cat();
catArray[i] = someCat;
}
Approach 2
Cat[] catArray = new Cat[num]
for (int i = 0; i < num; i++) {
catArray[i] = new Cat();
}
Is there any tangible difference in the above two ways of initializing and filling an array of objects in terms of memory usage and/or performance?