File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes what mean is instantiate the class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what mean is instantiate the class?" Watch "what mean is instantiate the class?" New topic
Author

what mean is instantiate the class?

Adam Lim
Greenhorn

Joined: Mar 13, 2007
Posts: 5
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

Joined: Jun 10, 2008
Posts: 156

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.


Priety.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

instantiating a class simply means you are creating object of it !


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Adam Lim
Greenhorn

Joined: Mar 13, 2007
Posts: 5
ok, i am understand now.

thank you
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39070
    
  23
. . . and welcome to JavaRanch
 
GeeCON Prague 2014
 
subject: what mean is instantiate the class?