What happens when you assign a pre initialized reference some other object ?
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers

 Q1. What happens when you assign a pre initialized reference some other object ?Core Java
Ans. Now the reference points to a new object in memory. If that was the only reference for the previous object , it will be marked for garbage collection.

Foe example -

Object obj = new Object();
obj = new Object();

object created in first line will be eligible for garbage collection after line 2 as it looses all it's handlers.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     references  objects  garbage collection     Asked in 1 Companies


Related Questions

  What are the common uses of "this" keyword in java ?
  What are strong, soft, weak and phantom references in Java ?
 When we say final x = 10, is the reference final or the value ?
  Difference between a Pointer and a Reference ?
 How are values passed in Java ? By value or reference ?
  If a method definition has been specified in Class , its Base Class , and the interface which the class is implementing, Which definition will be picked if we try to access it using Interface Reference and Class object ?
  If a method definition has been specified in the Base Class and the interface which the class is implementing, Which definition will be picked if we try to access it using Interface Reference and Class object ?
  Can we access Interface static method using Interface references ?
  Why is null == null returns true ?
  Can we have foreign key reference to a non primary key column ?



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: