-
what is the difference between refernce an instance of a class.can u provide me some clear exemples.
-
Reference variables holds memory location where the object has been created. When we destroy an object, actually we destroy the reference so as the object iteself.
Customer cust = new Customer();
Here, cust is an object reference variable (which points to the memory location where the Customer instance is created). So, a Customer instance is created and the reference is stored in the reference variable.