下面语句输出
inta=100;
if(a<100)
if(a<200){
System.out.println("a<200");
System.out.println("a<300");
}
inta=100;
if(a<100)
if(a<200){
System.out.println("a<200");
System.out.println("a<300");
}
举一反三
- 请看下面的程序代码,当 n 为( )值时,程序段将输出字符串 second。 [br][/br] switch(n) { [br][/br] case 0: System .out .println(“first”); [br][/br] case 1: [br][/br] case 2: System .out .println(“second”); break; [br][/br] default: System .out .println(“end”); [br][/br] }(2.0) A: 0 B: 1 C: 2 D: 以上都可以
- 应用程序的main方法中有以下语句,则输出的结果是 ( )。 HashMap map=new HashMap(); map.put("100","aaa"); map.put("200","bbb"); map.put("300","ccc"); System.out.println(map.get("300").toString()+ map.get("200").toString() + map.get("100").toString());
- 中国大学MOOC: 下列代码中构造方法的返回类型是()public class Village { Village () { System .out .println(“hiding in Village”) ; } public static void main( String args [ ]) { Village c =new Village ( ) ;}class Village { public static void main( String args [ ]) { Village c =new Village ( ) ; } Village () { System .out .println(“hiding in Village”) ; } }
- 下列选项中,不能输出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) ;
- A gas system absorbs 200J of heat and simultaneously does 300J work on surroundings at a given temperature, what is △U in joules for the gas system? A: +100 B: -200 C: +200 D: -100