Przykład zadania

0

Prosze o Pomoc!

Jakie zadanie realiuje poniższy program?

import java.util.*;

public class hash {
public static void main (String args[]) throws Exception {
Hashtable hash = new Hashtable(10,10);

for (int i = 0; i <= 100; i++)
{
Integer integer = new Integer ( i );
hash.put( integer, "Number : " + i);
}

System.out.println (hash.get(new Integer(5)));

System.out.println (hash.get(new Integer(21)));

System.in.read();

for (Enumeration e = hash.keys(); e.hasMoreElements();)
{
System.out.println (hash.get(e.nextElement()));
}
}
}

0

Jak w zalaczonym kodzie widac testuje tablice haszujaca: dodaje elementy, wypisuje dwa znalezione, nastepnie wypisuje reszte w wewnetrznym porzadku kontenera.

pozdrawiam
johny

1 użytkowników online, w tym zalogowanych: 0, gości: 1