Both, g1 and g2 are references. But g2 is not initialized, so couldn't be used in code.
//Tells that g1 g2 should hold Gui object. Currently they are not holding any object.
Gui g1;
Gui g2;
//Now g1 reference holds object. g2 reference still doesn't point to any object.
g1 = new GUI();