You are not logged in.

#1 2015-06-10 10:40:36

husnain
User RankUser RankUser RankUser RankUser RankUser Rank
Administrator
From: Chichawatni,Pakistan
Registered: 2014-10-03
Posts: 8,129
Website

Class Test:

Question:
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?

Option A):
[banana, cherry, papaya, apple, apple, mango]
Option B):
Compile Error
Option C):
[banana, cherry, papaya, apple, mango]
Option D):
[apple, banana, cherry, mango, papaya]

Correct Answer is Option C):
[banana, cherry, papaya, apple, mango]


You cannot discover the new oceans unless you have the courage to lose the sight of the shore.

2015-06-10 10:40:36

Advertisement
Ads By Google

Re: Class Test:



Board footer