Menu
Question Index
...

What will be the output of the following program?

import java.util.*;

public class Cloning
{
    public static void main(String args[])
    {
        Vector<String> vector = new Vector<String>();
        vector.add("One");
        vector.add("Two");
        vector.add("Three");
        vector.add("Four");
        System.out.println("Original vector: " + vector);

        Vector<String> copy = (Vector<String>) vector.clone();
        System.out.print("After cloning: " + copy);
    }
}


Original vector: [One, Two, Three, Four]
After cloning: [One, Two, Three, Four]
Original vector: [One, Two, Three, Four]
After cloning: [One, Two, Three, Four]
Original vector: [One, Two, Three, Four]
After cloning: [Four, Three, Two, One]
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java Vector

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App