1.Whenever an object is created , memory wil be allocated for the instance variables also.They will be stored in the heap memory along with the object to which they belong
2.Note :Here it is assumed that reference variable declaration is done inside the main() method,hence will be treated as a local variable and memory will be allocated in the stack
3.Garbage Collection

浙公网安备 33010602011771号