Set类型的对象set可以以几种形式输出其内容?( )
A: Iterator it = set.iterator();while (it.hasNext()) {System.out.println(it.next());}
B: for (int i = 0; i < set.size(); i++) {System.out.println(set.get(i));}
C: System.out.println(set.toString());
D: for (Object obj : set) {System.out.println(obj);}
A: Iterator it = set.iterator();while (it.hasNext()) {System.out.println(it.next());}
B: for (int i = 0; i < set.size(); i++) {System.out.println(set.get(i));}
C: System.out.println(set.toString());
D: for (Object obj : set) {System.out.println(obj);}
举一反三
- 下列选项中,不能输出100个整数的是______。 A: A) for(int i=0;i<100;i++) B: System.out println(i) : C: B) int i=0: D: do E: System out.println(i) ; F: i++: G: while(i<100) ; H: C) int i=0: I: while(i<100) J: System.out.println(i) ; K: i++: L: D) int i=0; M: while(i<100) N: i++: O: if(i<100) continue; P: System.out.println(i) ;
- I try to()a few dollars each month in order to buy a new bike. A: set up B: set out C: set off D: set aside
- It's been very cold the last few days. I think the winter's ______ already. A: set in B: set off C: set on D: set out
- New students spend hours in the library, trying to()the system of arranging the books. A: work out B: cross out C: set out D: put out
- 下列选项中,循环会无限执行的是______。 A: int i = 1 ; while ( i < 10) System .out .print( “ ” + i) ; B: for( int i = 1 ; i < 10 ;i ++) System .out .print( “ ” + i); C: for( int i = 10 ; i > 0 ;i --) System .out .print( “ ” + i); D: int i = 1 ; while (true) { System .out .print( “ ” + i); i ++ ; if ( i > 5) break ;