10:11 am - Wednesday December 19, 2018

Hashtable Example program for put(K key, V value)

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 :candidjava.com
Description: Maps the specified key to the specified value in this hashtable.
 */
import java.util.*;
import java.util.Hashtable;
import java.io.IOException;

public class HashtablePutExample {
	public static void main(String args[]) throws IOException {
		Hashtable h = new Hashtable();
		h.put(1, 11); // returns the value and key which maps to the hashtable
		h.put(2, 22);
		h.put(3, 33);
		System.out.println(h);
	}
}

Output
{3=33, 2=22, 1=11}

Filed in: Z-A All Java Codes

Comments are closed.