11:13 pm - Saturday May 27, 2017

Calculate size of Hashtable int size()

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

BACK

                                   This method returns the number of keys in the hashtable.

Example Program


import java.util.Hashtable;

public class HashtableSize 

{

	public static void main(String args[]) 
	
       {

		Hashtable htable = new Hashtable(3);

		htable.put(1, "Add");

		htable.put(2, "Sub");

		htable.put(3, "Mul");

		htable.put(4, "Div");

		htable.put(5, "Exp");

		System.out.println("Size of the hash table is: " + htable.size());

	  }

}

Output

        Size of the hash table is: 5

 

BACK

Filed in: Java Examples

Comments are closed.