Hashtable: get(E e) : Hashtable : java.util : Java by API examples (example source code) Organized by topic

Java by API
C++
PHP


Java by API  »  java.util   » [  Hashtable  ]   
 



Hashtable: get(E e)

/*
 * Output: 

Beijing is located in China

 */

import java.util.Hashtable;

public class MainClass {

  public static void main(String args[]) {

    Hashtable ht = new Hashtable();
    ht.put("Tokyo""Japan");
    ht.put("Beijing""China");
    ht.put("Bangkok""Thailand");

    String city = "Beijing";
    String country = (Stringht.get(city);
    if (country != null)
      System.out.println(city + " is located in " + country);
    else
      System.out.println(city + " is not located in the hashtable");
  }
}

     

           
       
Related examples in the same category
1.  new Hashtable()
2.  new Hashtable < K, V > ()
3.  Hashtable: entrySet()
4.  Hashtable: iterator()
5.  Hashtable: keySet()
6.  Hashtable: put(K key, V value)
7.  Hashtable: keys()
























Home| Contact Us
Copyright 2003 - 07 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.