Click here to watch in Youtube :
https://www.youtube.com/watch?v=Eg7sbK5WgzY&list=UUhwKlOVR041tngjerWxVccw
HashtableExample.java
Output
https://www.youtube.com/watch?v=Eg7sbK5WgzY&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<Integer, String> hashtable = new Hashtable<Integer, String>(); System.out.println("hashtable : " + hashtable + "\n"); hashtable.put(1, "Apple"); hashtable.put(2, "Ball"); hashtable.put(3, "Cat"); System.out.println("hashtable : " + hashtable); } }
hashtable : {} hashtable : {3=Cat, 2=Ball, 1=Apple}
https://sites.google.com/site/javaee4321/java-collections/HashtableDemoDefaultCons.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment