hi im getting index out of bound error i cannot find exactly were the error is coming from.can anybodyhelp.tnks
import java.util.*;
class allshortinVector
`{`
static Vector<String> v2=new Vector();
public static void main(String[] args)
{
Vector<String> v=new Vector();
v.addElement("test");
v.addElement("hello");
v.addElement("JAVA");
v.addElement("Program");
for(int i=0 ; i < v.size() ; i++)
{
if( (v.elementAt(i).length()) < (v.elementAt(i + 1).length()) ) // checking which element is the longest
{
v2.addElement(v.elementAt(i)); // store them in vector v2
}
}
for(String z : v2)
System.out.println(z);
}
}