This sample code go through Hashtable and read all its keys and values.
import java.util.*; ... /* -- get system properties */ Hashtable h = System.getProperties(); /* -- get keys */ Enumeration e = h.keys(); /* -- read and write all keys */ while( e.hasMoreElements() ) { /* key */ Object k = e.nextElement(); /* read key */ System.out.print( k ); /* read key value */ System.out.println( "\t\t" + h.get( k ) ); }The output could be (depending on installed JDK and current system):
java.runtime.name Java(TM) SE Runtime Environment sun.boot.library.path C:\Program Files\Java\jdk1.7.0_07\jre\bin java.vm.version 23.3-b01 java.vm.vendor Oracle Corporation java.vendor.url http://java.oracle.com/ path.separator ; java.vm.name Java HotSpot(TM) Client VM ...