Let's say I have classes A and B and the code is something like this:
class A
{
private int x;
private int[] y=new int[10];
private string s;
}
public class B
{
public static void main(String args[])
{
A a=new A();
}
My understanding is when class A has no constructors defined JVM automatically defines a constructor like this:
//Auto generated constructor
A()
{
x=0;
s=NULL;
y[]=//What will come here
}
I want to know what value will be assigned to the array data type in this auto generated constructor.If it assigns zero to all the place holders doesn't it affect the performance of the program for large size arrays since assigning zero to all the members of the array is not a cheap task in terms of time.
Note:(UPDATE)
It doesn't store null.What is the default initialization of an array in Java? It store zeros.So my question is will it affect the performance for large arrays.