-
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(10));
object.addElement(new Integer(20));
object.addElement(new Integer(50));
object.removeAll(object);
System.out.println(object.isEmpty());
}
}
-
- True
- False
- 0
- 1
- None of these
Correct Option: A
firstly elements 10, 20, 50 are entered in the vector object, but when object.removeAll(object); is executed all the elements are deleted and vector is empty, hence object.isEmpty() returns true.