//aaii hs.add(new student () ashSet y(h) while(it.hasNext()) 10111i1111111111 Student temp-(Student)it.next(); tea即.c1a8gm-2003001 in(et() 通过javac、java等命令编译并运行程序,程序运行结果如图6-32所示。 20 20 //main // Has hS et H as hS et hs =n ew H as hS et( ); // HashSet h s. ad d( new S tu de nt (" tom ", 21 ,9 70 05 )); h s. ad d( new S tu de nt (" jer ry ", 19 ,9 70 03) ); h s. ad d( new S tu de nt (" luc y" ,1 8, 97 00 4)) ; // Ha sh Set System.out.println(" H as hS et " ); S ys te m. out .p ri nt ln (h s); // I te ra to r i t= hs .i te ra tor () ; // w hi le (i t.h as Ne xt () ) { // St ud en t t em p= (S tu de nt) it .n ex t( ); // te mp .c las sN um =2 00 30 01; } // Ha sh Set System.out.println(" H as hS et " ); S ys te m. out .p ri nt ln (h s); 通过 javac、java 等命令编译并运行程序,程序运行结果如图 6-32 所示