Menu
Topics Index
...
`

Colours2473


If you need explanation Read this topic

If you need Answer Take test on this topic

Colours2473
What will be the output of the following program?
import java.util.*;
public class Colours {
    public static void main(String args[]) {
        NavigableMap clr = new TreeMap();
        clr.put(4, "red");
        clr.put(6, "blue");
        clr.put(8, "white");
        clr.put(10, "green");
        System.out.println(clr.ceilingEntry(5));
        System.out.println(clr.ceilingEntry(7));
    }
}

A. 6=blue
6=blue
B. 4=red
6=white
C. 6=blue
8=white
D. Compilation Error or Runtime Error
Topic: TreeMap In Java - java.util.TreeMap

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.

option : C
ceilingEntry returns Entry which is greater than or equal to specified entry

Posted by Kittu Manoj    2014-04-04 12:48:44


Ans is c The java.util package only has one implementation of the NavigableMap interface: java.util.TreeMap and it takes value grater than entry value

Posted by Bharath Yelchuri    2014-04-04 13:04:16


ans is C, ceilingEntry(key) method is used to return a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such key

Posted by Raviteja Daggupati    2014-04-04 14:04:01


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

Posted by Merit Campus    2014-04-07 13:32:04


© meritcampus 2019

All Rights Reserved.

Open In App