[Logo]
Forums Register Login
what mean is instantiate the class?
hi all.. i am confuse with the meaning for instantiate the class?

when i
Test test1 = new Test();

am i instantiate the Test class into test1 ?


please advise..
Hi,

When you are doing "new Test()" creating an instance of the class Test. i.e. instantiating the class.

test1 is a reference variable of the type Test.
by doing :
Test test1 = new Test();
you are storing the reference of the Test class instance in the variable test1.

So that you could use if further to invoke methods or access member variables.

Regards,
Priety.
instantiating a class simply means you are creating object of it !
ok, i am understand now.

thank you
. . . and welcome to JavaRanch
Mo-om! You're embarassing me! Can you just read a tiny ad like a normal person?
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss


This thread has been viewed 10952 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jul 18, 2018 05:01:24.