import java.util.Collections; import java.util.Hashtable; import java.util.Map; public class Demo { public static void main(String[] s) { Hashtable<String, String>hash = new Hashtable<String, String>(); hash.put("1", "A"); hash.put("2", "B"); hash.put("3", "C"); hash.put("4", "D"); hash.put("5", "E"); hash.put("6", "F"); hash.put("7", "G"); hash.put("8", "H"); hash.put("9", "I"); hash.put("10", "J"); System.out.println("Hashtable = " + hash); Map<String, String>m = Collections.unmodifiableMap(hash); System.out.println("Hashtable is now read-only!"); } }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more