Menu
Question Index
...

What will be the output of the following program?

import java.util.*;
public class Days {
    public static void main(String args[]) {
        NavigableMap<Integer, String> day = new TreeMap<Integer, String>();
        day.put(1, "Sunday");
        day.put(3, "Tuesday");
        day.put(5, "Thursday");
        day.put(7, "Saturday");
        System.out.print(day.descendingMap());
    }
}


{7=Saturday, 5=Thursday, 3=Tuesday, 1=Sunday}
{7=Saturday, 1=Sunday, 3=Tuesday, 5=Thursday}
{7=Saturday, 1=Sunday, 5=Thursday, 3=Tuesday}
Compilation Error or Runtime Error

Doubts

Problems

Topic: TreeMap In Java - java.util.TreeMap

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App