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. When we create reference for primitive type, it's memory is allocated. So even if we don't assign any value to it, the default value is initialized. int x; // default value 0 initialized But for object references, it's different as references hold nothing till an object is assigned. Object obj; // contains null So all primitive types when declared , contains their respective default values on the basis of their type whereas all wrapper class References contains null irrespective of their types. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   | ||||
Related Questions | ||||
Will this code give error if i try to add two heterogeneous elements in the arraylist. ? and Why ? | ||||
What are the Wrapper classes available for primitive types ? | ||||
What are wrapper classes ? | ||||
What are the benefits of using Wrapper classes over primitive types ? | ||||
Explain Autoboxing ? | ||||
Difference between boolean and Boolean ? | ||||
What are Wrapper Classes ? What are Primitive Wrapper Classes ? | ||||
What Design pattern Wrapper Classes implement ? | ||||
Can we compare Integers by using equals() in Java ? | ||||