Home » JAVA Programming » Object & Classes » Question
  1. What is the stored in the object obj in following lines of code?

    box obj;
    1. Any arbitrary pointer
    2. Memory address of allocated memory of object
    3. Garbage
    4. NULL
    5. None of these
Correct Option: D

Memory is allocated to an object using new operator. box obj; just declares a reference to object, no memory is allocated to it hence it points to NULL.



Your comments will be displayed only after manual approval.