This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
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
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: when to initialise or instantiate the Vector
 
Similar Threads
<identifier> expected problem - Vectors.
Vectors within vectors
variable declaration
Vectors within vectors
Any benefit by using StringBuffer like this?