Menu
Question Index
...

What will be the output of the following program?

import java.util.*;

public class Hp00001
{
    public static void main(String[] args)
    {
        Vector vect = new Vector();
        vect.addAll("2", "10", "3", "11", "7", "5", "4", "1", "22", "9", "6", "4", "8", "4", "4");
        Object[] obj = new Object[11];
        vect.copyInto(obj);
        Arrays.sort(obj);
        Collections.reverse(vect);
        for (int index = 0; index < 11; index++)
            if (vect.get(index) != obj[index])
                System.out.print(vect.get(index) + " ");
    }
}


4 4 8 4 6 9 22 1 5 7 11 3 10 2
4 4 8 6 9 22 1 4 5 7 11 3 10 2
4 4 8 4 6 9 22 1 5 7 11 3 10
4 4 8 6 9 22 1 4 5 7 11 3 10
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