Menu
Question Index
...

What will be the output of the following program?

import java.util.*;
public class Numbers {
    public static void main(String args[]) {
        Map<String, Integer> map = new HashMap<String, Integer>();
        map.put("one", 1);
        map.put("two", 2);
        map.put("three", 3);
        Set<String> key = map.keySet();
        boolean c = map.containsKey(key);
        boolean d = map.containsKey("one");
        System.out.println(c + ", " + d);
    }
}


true, true
false, false
false, true
true, false
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java HashMap Implementation

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App