PDA

View Full Version : [JAVA]how move my string array in vector


mfa
01-13-2007, 06:13 AM
hi master
sir i have string array how i add that array in vector

i tried flowing code
but not give me restul

String[] jlf = {"Muhammad","Fahim","Aamir"};

vector.addElement(jlf);


plsease give me idea how i add array in vector

thank
aamir

liorean
01-13-2007, 06:19 AM
JavaScript is an entirely different language than Java. Moving this to the Computer Programming forum.

Aradon
01-13-2007, 08:02 AM
With Java Generics you can easily add String Objects to an array. If you know anything about Java Generics then you know you can specify an object inside of the generic. By the way, this is only in Java 5.0 / 1.5 (it's the same thing).
Here is an example:


import java.util.*;
public class testGenerics {

public static void main(String args[])
{
Vector<String[]> v = new Vector<String[]>();
String[] ar = {"dur", "de", "kl" };
v.add(ar);
}
}


Hope that helps.