Menu
Question Index
...

What will be the output of the following program?

import java.util.*;

public class CheckingElements
{
    public static void main(String args[])
    {
        Vector<String> vector = new Vector<String>();

        String test = "A";
        vector.add("65");
        vector.add("66");
        vector.add("67");
        vector.add("69");
        vector.add("51");
        
        List<String> list = new ArrayList<String>();
        list.add("66");
        list.add("67");
        int j = (int) test.charAt(0);
        System.out.println("Vector contains all list elements: " + vector.containsAll(list));

        list.add(Integer.toString(j));
        System.out.println("Vector contains all list elements: " + vector.containsAll(list));
    }
}


Vector contains all list elements: true
Vector contains all list elements: false
Vector contains all list elements: true
Vector contains all list elements: true
Vector contains all list elements: false
Vector contains all list elements: true
Vector contains all list elements: false
Vector contains all list elements: false
Compilation Error or 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