Can someone tell me how I can use a Vector to access my class?

I wrote a class that will need to be instantiated with unknown instances later. I decided to use a Vector to do this. However when I created the vector:
<CODE>
Vector user = new Vector(1,1);
user.addElement(Users());
user.elementAt(0).name="Test";
</CODE>
I'm really not sure how I can set this. The class is of course Users and I want to set user as the Vector but specify Users as the Object Type. Any help? By the way I heard Java has a dynamic array feature is this true? I heard you had to use Vectors for Java. Also how can I free up the memory when I'm done with the class?

Suppose class User looks like this:
public class User
  public String name;
}then you could do:Vector users = new Vector(1,1);
users.addElement(new User());
((User)users.elementAt(0)).name="Test";BTW - Java is NOT C++, you always need to use the new keyword for object creation!

Similar Messages

Maybe you are looking for

  • Exposure control in Vision Builder AI

    Hello, is there any way of adjusting the exposure time and/or gain of a NI17xx camera programmatically ??

  • How to make Profit Center Mandatory

    Dear Sir, We are using New GL functionality in ECC-6 . During Document Splitting we desire that Profit Center must be mandatory , so that no entry is posted in "Non Assigned Profit Center" Kindly guide us as how can we make Profit Center mandatory .

  • What's slowing down Safari 4.0.3 ?

    Lets say a site has 43 items. Safari will load 42 in the blink of an eye and then take forever (2 to 5 min.) to load the last item (as per the Status Bar at the bottom of the window). Same thing happens if a site has 240 items; Safari loads 239 faste

  • Is it true Creative Cloud is only needed if renting Adobe software?

    I do not rent any Adobe programs. I own a copy of Adobe Acrobat Pro IX, and Elements. Since these programs are not rented; then is it correct Creative Cloud is useless here? The Apple computer I use has Creative Cloud always coming up at start up. Is

  • Parent Total and Parent Currency Total

    Can you please explain the what is the parent total and parent currency total ... please correct me if this wrong parent total is the total of the previous level plus any adjustments applying to the specified parent the parent curr total is the total