12:50 am - Monday August 21, 2017

Remove a data from hashtable by its key V remove(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

BACK

This method removes the specified key value from the hashtable.

Example Program


import java.util.Hashtable;

public class Hsht

{

public static void main(String args[])

{

Hashtable htable = new Hashtable(3);

htable.put(1, "Add");

htable.put(2, "Sub");

htable.put(3, "Div");

htable.put(4, "Mul");

htable.put(5, "Exp");

System.out.println("Initial hash table value: " + htable);

htable.remove(3);

System.out.println("Hash table value after remove: " + htable);

}

}

Output

           Initial hash table value: {5=Exp, 4=Mul, 3=Div, 2=Sub, 1=Add}

           Hash table value after remove: {5=Exp, 4=Mul, 2=Sub, 1=Add}

BACK

Filed in: Java Examples

Comments are closed.