Which constructor is called when we try to do the follow:
int[] arr = new int[10];
From what I understand, for every single time that we use the keyword new
, an object
is created inside the Heap, using the constructor of the respective class, and its address is returned back to the reference variable.
My question is; Since Boolean, byte, short, character, int.... are all primitives and don't have a built in class or a constructor (at least I couldn't find one inside the src.zip),
boolean[] b = new boolean[10];
byte[] by = new byte[10];
short[] s = new short[10];
char[] ch = new char[10];
int[] i = new int[10];
long[] l = new long[10];
float[] f = new float[10];
double[] d = new double[10];
What object is returned when we try to create their array using new
and how is that object created?