class Test
{
public static void main(String [] args) throws Exception
{
Vector data = new Vector();
data.add("apple");
data.add("mango");
data.add("papaya");
data.add("cherry");
data.add("banana");
data.add("apple");
System.out.println(getData(data));
}
public static Vector getData(Vector v)
{
return new Vector(new HashSet(v));
}
}
What would be the output?
Options
- Compile Error
- [apple, banana, cherry, mango, papaya]
- [banana, cherry, papaya, apple, mango]
- [banana, cherry, papaya, apple, apple, mango]
CORRECT ANSWER : [banana, cherry, papaya, apple, mango]
Write your comments