3:11 pm - Monday November 25, 8678

Hashtable Example program for containsKey(Object key)

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

/**

*@author:kingsley
*@description:Hashtable Example program for ContainsKey

*/

import java.util.Hashtable;

class HashTableExam

{

public static void main ( String[] args )
{


Hashtable ht=new Hashtable(); // creating hashtable object

ht.put(1, "kings");    // ht.put(key,"value")
ht.put(2, "manee");
ht.put(3, "sathish");  // adding hashtable with keys
ht.put(4, "kings");

System.out.println("Hash table contains key number '4' :" + ht.containsKey(4) ); // Using hashtable containsKey() method;

}

}


Output:

Hash table contains key number ‘4’ : true

BACK

Filed in: Z-A All Java Codes

Comments are closed.