In very simple words DCL happens like this. suppose
1) Two threads A and B enter into getInstance() method.
2) Both Thread A and B enters into line number 0 and both cross this as instance is null.
3) Assume Thread A gets lock and on Singleton.class at line no. 1 and Thread B gets block
here to get Singleton.class monitor lock.
4) Thread A moves to line no 3 and creating the instance of Singleton class and this
time Thread C comes and calls getInstance() and it saw that instance is not null and
Thread A is assigned the space but object is still not properly constructed and method
getInstance() returns the partial constructed instance to Thread C at line 4.
Singleton class with making instance as volatile