Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

when to initialise or instantiate the Vector

 
Michelle Joe
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What does this object and method do?
v = mgr.displayUser();
 
Michelle Joe
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kaz Yosh,
Basically, displayUser() will return the user details in Vector form.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic