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.
|Interview Questions and Answers|
|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|
|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 ?|