After reading this article I am confused about the 2nd step of the JVM.
class Liquid { private int mlVolume; private float temperature; // in Celsius Liquid(int mlVolume, float temperature) { this.mlVolume = mlVolume; this.temperature = temperature; } //... } // In source packet in file init/ex18/Coffee.java class Coffee extends Liquid { private boolean swirling; private boolean clockwise; public Coffee(int mlVolume, float temperature, boolean swirling, boolean clockwise) { super(mlVolume, temperature); this.swirling = swirling; this.clockwise = clockwise; }When you instantiate a new Coffee object with the new operator, the Java virtual machine first will allocate (at least) enough space on the heap to hold all the instance variables declared in Coffee and its superclasses. Second, the virtual machine will initialize all the instance variables to their default initial values. Third, the virtual machine will invoke the (init)/super constructor method in the Coffee class.
It says that 2nd step initializes all the instance variables to their default value . In this case, firstly the JVM does this ?
Liquid
this.mlVolume = 0;
this.temperature = 0
Coffee
this.swirling = 0;
this.clockwise = 0;
and only after the Liquid(int, float) has been called it does this :
Liquid
this.mlVolume = mlVolume;
this.temperature = temperature;
Coffee
this.swirling = swirling;
this.clockwise = clockwise;
What does he exactly mean by 2nd Step ?