Computer scienceProgramming languagesJavaWorking with dataCollectionsCollection implementationsThe Map hierarchy implementations

Map implementations

Building a TreeMap

Report a typo

Create a TreeMap named map and fill it with the following three key-value pairs:

Omega - 24
Alpha - 1
Gamma - 3

where strings are keys and numbers are values.

The code for displaying the map is already written.

Sample Input 1:

Sample Output 1:

{Alpha=1, Gamma=3, Omega=24}
Write a program in Java 25
import java.util.*;

public class Main {

public static void main(String[] args) {
// write your code here
System.out.println(map);
}
}

Create a free account to access the full topic