Example: Date date1 = new Date ();
1. Execute this code, the virtual machine first find whether the Date.class file has been loaded, if it has been loaded directly jump to the 3rd step, if not the classpath and relative path lookup, the way to find is determined by ClassLoader.
2. Locate the Date.class file, the virtual machine loads the Date.class file into memory, parses the meta-information such as class and annotations, and the virtual machine guarantees that each Date.class file is loaded only once.
3. Request the memory space in the heap to hold the instance of date for the initialization of the variable (the different instances of the class are different only in the variable part, the method shares the same memory ), and the non-parametric constructor method, date (), is initialized.
4. In the stack, request memory space to hold the Date1 handle variable , assigning the initialized instance handle to the Date1 variable.
What the Java new does