Menu
Question Index
...

What will be the output of the following program?

import java.util.*;

public class BinarySearch
{
    public static void main(String[] args)
    {
        Vector<String> characters = new Vector<String>();
        characters.add("M");
        characters.add("E");
        characters.add("R");
        characters.add("I");
        characters.add("T");
        Collections.reverse(characters);
        Collections.sort(characters);
        int position = Collections.binarySearch(characters, "I");
        System.out.println("Character found at : " + position);
    }
}


Character found at : 4
Character found at : 3
Character found at : 1
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