How Is Instantiation Different from Initialization of a Java Variable?

Variables in Java store data (e.g., a string or number). How is instantiation of a variable different from initialization, or are they the same?

Instantiation is different from initialization. Instantiation is the creation of the variable (e.g., through the Java syntax or invocation of a method that creates the variable). A class can be instantiated or a primitive variable can be instantiated. Instantiation involves memory allication for the object (either for a class or a primitive value). See Oracle documentation and TechTarget's definition.

Initializing a variable is the act of giving a variable a specific value. When a variable is assign an initial value, this is initialization.

"Variables are containers for storing data values." (Taken from

Instantiation and initialization are terms used outside of Java.

Leave a comment

Your email address will not be published. Required fields are marked *