Click here to watch in Youtube :
https://www.youtube.com/watch?v=RfHxc5ovkGE&list=UUhwKlOVR041tngjerWxVccw
HashtableExample.java
Output
https://www.youtube.com/watch?v=RfHxc5ovkGE&list=UUhwKlOVR041tngjerWxVccw
HashtableExample.java
import java.util.Hashtable; /* * Example of default Hashtable() Constructor. */ public class HashtableExample { public static void main( String[] args ) { /* * Constructs a new, empty hashtable with a default initial capacity * (11) and load factor (0.75). */ Hashtable<String, String> hashtable = new Hashtable<String, String>(); System.out.println("hashtable : " + hashtable + "\n"); /* * Key = CountryCode,Value = CountryName */ hashtable.put("AF", "AFGHANISTAN"); hashtable.put("BE", "BELGIUM"); hashtable.put("US", "UNITED STATES"); hashtable.put("IN", "INDIA"); System.out.println("hashtable : " + hashtable); } }
hashtable : {} hashtable : {IN=INDIA, AF=AFGHANISTAN, BE=BELGIUM, US=UNITED STATES}
https://sites.google.com/site/javaee4321/java-collections/HashtableDemoDefaultConsCountryCode.zip?attredirects=0&d=1
See also: