Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what mean is instantiate the class?

 
Adam Lim
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Priety Sharma
Ranch Hand
Posts: 156
Android Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
instantiating a class simply means you are creating object of it !
 
Adam Lim
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, i am understand now.

thank you
 
Campbell Ritchie
Sheriff
Pie
Posts: 50225
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and welcome to JavaRanch
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic