Java-source: Parcourir les valeurs d’un HashTable

Author:

Java-source: Parcourir les valeurs d'un HashTable
{filelink=452}

/***** Code de MesExemples.com *******/
import java.util.Hashtable;
import java.util.Enumeration;

 class ExempleIterateHashtable
{

public static void main(String[] args) {

//create Hashtable object
Hashtable hashTab = new Hashtable();

//Ajout des éléments dans HashMap
hashTab.put("1","Allo");
hashTab.put("2","Hello");
hashTab.put("3","Hola");


/*
  Obtenir les valeurs dans un énumérateur
  */
Enumeration e = hashTab.elements();

//Parourir et afficher les valeurs
while(e.hasMoreElements())
System.out.println(e.nextElement());
}
}

/*
Hola
Hello
Allo
*/

A Voir sur le même Sujet:

  • importer HashTable
  • accéder valeur hashtable
  • java parcourir une énumération
  • parcourir rtf table en java
  • parcourir hashtable java
  • parcourir hashtable en java
  • afficher hashmap générique
  • parcourir hashtable
  • parcourir une hashtable
  • comment affiche hashtable sur jframe java

Leave a Reply

Your email address will not be published. Required fields are marked *