Answers for "how to put value in map in java"

-1

java map create with values

Map<String, String> doubleBraceMap  = new HashMap<String, String>() {{
    put("key1", "value1");
    put("key2", "value2");
}};
Posted by: Guest on December-03-2021
0

map.put in java

import java.util.*;
public HashMap{
    public static void main(String[] args){
        Map<Integer, String> map = new HashMap<>();//initialization of HashMap 
        map.put(key, value);//key and value must be entered
        System.out.println(map);
    }
}
Posted by: Guest on May-21-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language