Menu
Question Index
...

What will be the output of the following program?

import java.util.*;
public class Subjects {
    public static void main(String args[]) {
        Map<Integer, String> map = new HashMap<Integer, String>();
        map.put(1, "Telugu");
        map.put(2, "Hindi");
        map.put(3, "English");
        for (Map.Entry<Integer, String> entry : map.entrySet()) {
            System.out.println(entry.toString());
        }
    }
}


1 Telugu
2 Hindi
3 English
1,Telugu
2,Hindi
3,English
1=Telugu
2=Hindi
3=English
Some other output
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