home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / javafile / ch11 / StudentIDMap.java < prev    next >
Encoding:
Java Source  |  1998-12-14  |  740 b   |  27 lines

  1. import java.util.*;
  2.  
  3. public class StudentIDMap
  4. {
  5.     public static void main(String args[])
  6.     {
  7.         // Create the lists of failing students
  8.         String[] SNames = {"Amy", "Jose", "Jeremy", "Alice", "Patrick"};
  9.         String[] ID = {"123456789", "259879864", "988456997", "984876453", "9768696"};
  10.  
  11.         // Create the set to hold the failing students
  12.         Map IDMap = new HashMap();
  13.  
  14.         //Add the failing students from each class to the set
  15.         for (int i=0; i< SNames.length; i++)
  16.             IDMap.put(ID[i],SNames[i]);
  17.  
  18.  
  19.         //Print out the student list
  20.         System.out.println(IDMap.size()+" Students entered: ");
  21.         System.out.println(IDMap);
  22.  
  23.     }//Main
  24. }//StudentIDMap
  25.  
  26.  
  27.