Click here to watch in Youtube :
https://www.youtube.com/watch?v=n82DItya1AM&list=UUhwKlOVR041tngjerWxVccw
HashtableExample.java
Output
https://www.youtube.com/watch?v=n82DItya1AM&list=UUhwKlOVR041tngjerWxVccw
HashtableExample.java
import java.util.Hashtable; /* * Example of put(K key,V value) method. */ public class HashtableExample { public static void main(String[] args) { Hashtable<String, String> hashtable = new Hashtable<String, String>(); System.out.println("hashtable : " + hashtable + "\n"); /* * Key = CountryCode,Value = CountryName. * * Maps the specified key to the specified value in this hashtable. * * Neither the key nor the value can be null. The value can be retrieved * by calling the get method with a key that is equal to the original * key. */ hashtable.put("AF", "AFGHANISTAN"); hashtable.put("BE", "BELGIUM"); hashtable.put("US", "UNITED STATES"); System.out.println("hashtable : " + hashtable); } }
hashtable : {} hashtable : {AF=AFGHANISTAN, BE=BELGIUM, US=UNITED STATES}
https://sites.google.com/site/javaee4321/java-collections/HashtableDemoPut.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment