Initialize Static Map Java
Method 1: import java.util.HashMap; import java.util.Map; public class Test { private static final Map<Integer, String> tempMap = new HashMap<>(); static { tempMap.put(1, "Sandy"); tempMap.put(2, "Roxy"); } }import java.util.HashMap; import java.util.Map; public class Test { private static final Map<Integer, String> tempMap = new HashMap<>(); static { tempMap.put(1, "Sandy"); tempMap.put(2, "Roxy"); } } Method 2: import … Read more