Core Java - Interview Questions and Answers for 'Reference vs object' | Search Java Interview Question - javasearch.buggybread.com
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

   



Core Java - Interview Questions and Answers for 'Reference vs object' - 1 question(s) found - Order By Newest

 Q1. What is the difference between reference and object ?Core Java2017-05-13 20:20:48

Ans. Object is an entity in Java , i.e which has a state ( instance variables ) and methods attached to it ( static or non static , through class definition ). References are the identifiers that are used to point to objects.

For example -

Employee emp = new Employee();
emp = new Employee();

In this code, emp is the reference that gets assigned to the new object created by the new operator. In the second line , we have assigned the same reference to another object. So with these 2 lines of code, we have 2 objects in memory with reference emp now pointing to second object.

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

   Like         Discuss         Correct / Improve     reference  object  reference vs object      Basic        frequent


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 ?
  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 ?
 What is RI or Reference Implementation ?



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: