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..

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.

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

thank you
. . . and welcome to JavaRanch

This thread has been viewed 11185 times.

All times above are in ranch (not your local) time.
The current ranch time is
Oct 18, 2018 21:37:47.