Guys what's the difference between both the term..it's little bit confusing : Initialization and Instantiation? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Guys what's the difference between both the term..it's little bit confusing : Initialization and Instantiation?

7th Mar 2020, 8:13 AM
I Am a Baked Potato
I Am a Baked Potato - avatar
6 Answers
+ 4
Initialization occurs when you assign something to a variable. In the other hand, Instantiation is the process of making an object of a type (class). Both are far different but can be used at the same time: ClassName uwu = new ClassName(); Here, you assigned (initialized) the variable 'uwu' with a reference of the created (instantiated) object in the class 'ClassName'. Ref: https://stackoverflow.com/questions/15074083/difference-between-initializing-a-class-and-instantiating-an-object
7th Mar 2020, 8:32 AM
Nootnoot
Nootnoot - avatar
+ 1
Google it
7th Mar 2020, 8:30 AM
Rajat Porwal
+ 1
int i; Class_Name obj; i=0; //initialization, assinging value obj=new Class_Name(); //instantiation. Creating new datatype or object
7th Mar 2020, 8:41 AM
Jayakrishna 🇮🇳
+ 1
Rajat Porwal Dude not every time google can solve your problem...sometime if you want to understand thing better , get it from the person who use that term frequently in it's program coz he is exprienced and can teach your better....If you don't wanna explain better don't reply. Liking your own comment lmao
7th Mar 2020, 9:01 AM
I Am a Baked Potato
I Am a Baked Potato - avatar
+ 1
SPICEAPPLE 🍎 { active: 0 } Jayakrishna Thanks it cleared my confusion...
7th Mar 2020, 9:05 AM
I Am a Baked Potato
I Am a Baked Potato - avatar
+ 1
Initialization- Assigning a value to a variable i.e a=0, setting the initial values. Instantiation- Creating the object i.e when you are referencing a variable to an object with new operator. Code: int a;//Declaration a=10;//Initialization Integer int1=new Integer(5);//Instantiation where Integer is a class and int1 is reference variable
7th Mar 2020, 9:24 AM
ROBIN C R
ROBIN C R - avatar