Menu
Topics Index
...
`

Geometry


If you need explanation Read this topic

If you need Answer Take test on this topic

Geometry
What will be the output of the following program?
import java.util.*;
public class Geometry {
    public static void main(String args[]) {
        Map<Integer, String> map = new HashMap<Integer, String>();
        map.put(1, "circle");
        map.put(2, "eclipse");
        map.put(3, "parabola");
        String k2 = map.get(1);
        boolean key = map.containsValue(k2);
        System.out.print(key);
    }
}

A. false
B. true
C. Some other output
D. Compilation Error or Runtime Error
Topic: Java HashMap Implementation

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Ans is b..becz map contains value with key 2

Posted by Uday Kumar    2014-07-15 03:46:04


Answer is B as k2 is circle and which contains in map so we get the output as true

Posted by Ashok Kumar Paritala    2014-07-15 03:47:34


b true bcoz here we are having the boolean data ye and the values is present in the key and value according to the map

Posted by Din Kurth    2014-07-15 11:21:01


Congratulations Uday Kumar. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-07-16 05:36:59


© meritcampus 2019

All Rights Reserved.

Open In App