class MyProgram { static void Main() { int[] integers; // declare array integers = new int[10]; // size array } }
In which line is the array actually instantiated?
Array get instantiated when you create it with new keyword:
integers = new int[10]; // size array
declaration can just create a reference.
int[] integers; // declare array
integers = new int[10];
Yep.. Just because you've declared a container, doesnt automagically mean its made, thefore the new keyword gives you the default contents for that type
int[] integers = new int[10];
her u put ur refrence in the stack pointed to integers[0] in the heap