File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes when to initialise or instantiate the Vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "when to initialise or instantiate the Vector" Watch "when to initialise or instantiate the Vector" New topic
Author

when to initialise or instantiate the Vector

Michelle Joe
Greenhorn

Joined: Oct 29, 2002
Posts: 11
1)
Vector v = null;
v = new Vector();
v = mgr.displayUser();
2)
// no initialisation and instantiation
Vector v = mgr.displayUser();
3)
// initialisation only
Vector v = null;
Vector v = mgr.displayUser();
Do i need to initialise or instantiate the class Vector before the method "displayUser() returned it as vector?
In fact, all approaches are working. But what i concerned is which one performs better and waste not much resources.
Kaz Yosh
Ranch Hand

Joined: May 22, 2003
Posts: 63
Hi,
What does this object and method do?
v = mgr.displayUser();


"If anything can go wrong, it will"
Michelle Joe
Greenhorn

Joined: Oct 29, 2002
Posts: 11
Kaz Yosh,
Basically, displayUser() will return the user details in Vector form.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: when to initialise or instantiate the Vector
 
Similar Threads
Vectors within vectors
Any benefit by using StringBuffer like this?
variable declaration
Vectors within vectors
<identifier> expected problem - Vectors.