To check the Size of Hashtable
Previous | Home | Next |
This examples shows how to check the size of Hashtabe.The Size () of Hashtable class of collection interface is used.
This examples shows how to check the size of Hashtabe.The Size () of Hashtable class of collection interface is used.
This examples shows how to check the size of Hashtabe.The Size () of Hashtable class of collection interface is used.
package Example;
import java .util.Hashtable;
public class SizeofHashtable {
public static void main(String[] args) {
Hashtable tb = new Hashtable();
System.out.println("The size of hashtable is:" +tb.size());
tb.put("12", "twelve");
tb.put("10", "ten");
tb.put("1", "one");
tb.put("2", "two");
System.out.println("The size of Hashtable is now :" + tb.size());
}
}
The size of hashtable is:0
The size of Hashtable is now :4
Previous | Home | Next |