String keys

Report a typo

What will you add to this code to get map values?

Sample Input 1:

1
2
3

Sample Output 1:

1, 2, 3
Write a program in Java 17
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

Map<String, Integer> map = ... // inititalize an instance of IdentityHashMap
map.put(new String("A"), scanner.nextInt());
map.put(new String("B"), scanner.nextInt());
map.put(new String("C"), scanner.nextInt());

// do not change the code below
System.out.println(
String.join(", ",
map.get("A").toString(),
map.get("B").toString(),
map.get("C").toString())
);
}
}
___

Create a free account to access the full topic