What happens in memory if we just create a reference variable or declare a variable for primitive data types or reference data types without initializing with any value as below?
int x;
Employee emp;
So what exactly happens in memory in both the cases?
Is any memory allocated at this stage or does it point to any random location or points to null or points to garbage values?
As in the 2nd case, only space will created in memory if we create a object using the constructor with new operator or using any other ways like.
Employee emp = new Employee();