Vidyalelo
Java Programming · Q156

Java Collections Framework

Programming · Java Programming · question 156

Q156

What will be the output of the following Java code? import java.util.*; class vector public static void main(String args[]) Vector obj = new Vector(4,2); obj.addElement(new Integer(3)); obj.addElement(new Integer(2)); obj.addElement(new Integer(6)); obj.insertElementAt(new Integer(8), 2); System.out.println(obj);

A.
[3, 2, 6]
B.
[3, 2, 8]
C.
[3, 2, 6, 8]
D.
[3, 2, 8, 6]
Answer

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board