Collections
- What is the output of this program?
import java.util.*;
public class vector_Example
{
public static void main(String args[])
{
Vector object = new Vector(6,3);
object.addElement(new Integer(5));
object.addElement(new Integer(7));
object.addElement(new Integer(9));
System.out.println(object.elementAt(2));
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
object.elementAt(2) returns the value stored at index 2, which is 9.
- Which of these methods is used to add elements in vector at specific location?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
addElement() is used to add data in the vector, to obtain the data we use elementAt() and to first and last element we use firstElement() and lastElement() respectively.
- What is the name of a data member of class Vector which is used to store a number of elements in the vector?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
elementCount
- Which of these is the interface of legacy?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Enumeration
- Which of these are legacy classes?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Stack, Hashtable, Vector, Properties and Dictionary are legacy classes.