What is the difference between declaration, instantiation and initialization ?

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 is the difference between declaration, instantiation and initialization ?Core Java
Ans. Declaration is intimation to the compiler about the nature of Data a reference is going to hold.

For example - List myList;

Instantiation is reservation of memory.

For example

myList = new ArrayList();

Initialization or construction is setting the default values for member elements.

For example

myList = new ArrayList(mySet);

** Example 2nd is both for instantiation as well as initialization. The only difference is that 2nd will initialized the member elements to their default values whereas 3rd will initialized it with the elements from set.

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

   Like         Discuss         Correct / Improve     declaration   instantiation   initialization   construction   declaration vs instantiation   instantiation vs initialization   declaration vs initialization     Asked in 1 Companies      basic        frequent

Related Questions

  What are the common uses of "this" keyword in java ?
  Can we use both "this()" and "super()" in a constructor ?
  Why every object constructor automatically call super() in Object before its own constructors?
  Does Constructor creates the object ?
  Can constructors be synchronized in Java ?
 What are constructors and Destructors in Java ?
  Are constructors inherited? Can a subclass call the parent's class constructor? When?
  Difference between object instantiation and construction ?
  Difference Between this() and super() ?
  What is constructor chaining and how is it achieved in Java?

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: