更多“3、给定Java代码如下,编译运行,结果是()。 class Test{ int i; public static void main(String args[]){ System.out.print…”相关的问题
第1题
给定如下Java 程序代码片段,编译运行这段代码,结果是 java.util.HashMap map = new java.util.HashMap(); map.put("name",null); map.put("name","Jack"); System.out.println(map.get("name"));
A.null
B.Jack
C.nullJack
D.运行时出现异常
点击查看答案
第2题
10、给定Java代码片断,如下: int i=0,j=-1; switch(i) { case 0,1:j=1; case 2:j=2; } System.out.print("j="+j); 编译运行,正确的结果是()。
点击查看答案
第3题
给定如下java代码,编译运行之后,将会输出()。 public class Test{ public staticvoid main(String args[]){ int a=5; System.out.println(a%2==1) ?(a+1) /2:a/2) ; } }
点击查看答案
第4题
给定如下Java代码片段,编译运行时,结果是() int [ ] a = {1,2,3,4,5}; for (int count = 0 ; count<5; count++) System.out.print(a[count++]) ;
A.运行时出现异常
B.输出:12345
C.输出:135
D.输出:24
点击查看答案
第5题
给定如下Java代码,编译运行的结果是()。 public class Test { public static void main(String[] args) { Map<String, String> map = new HashMap<String, String>(); String s = "code"; map.put(s, "1"); map.put(s, "2"); System.out.println(map.size()); } }
A.编译时发生错误
B.运行时引发异常
C.正确运行,输出:1
D.正确运行,输出:2
点击查看答案
第6题
39、给定如下Java代码片段,编译运行时,结果是() int [ ] a = {1,2,3,4,5}; for (int count = 0 ; count<5; count++) System.out.print(a[count++]) ;
A.运行时出现异常
B.输出:12345
C.输出:24
D.输出:135
点击查看答案
第7题
给定如下Java代码,编译运行的结果是()。 public class Test { public static void main(String[] args) { Map<String, String> map = new HashMap<String, String>(); String s = "code"; map.put(s, "1"); map.put(s, "2"); System.out.println(map.size()); } }
A.编译时发生错误
B.运行时引发异常
C.正确运行,输出:1
D.正确运行,输出:2
点击查看答案
第8题
给定如下Java代码,编译运行的结果是() public class Test { public static void main(String[] args) { Map<String, String> map = new HashMap<String, String>(); String s = "code"; map.put(s, "1"); map.put(s, "2"); System.out.println(map.size()); } }
A.编译时发生错误
B.运行时引发异常
C.正确运行,输出:1
D.正确运行,输出:2
点击查看答案
第9题
给定代码片段如下所示,则编译运行后,输出结果是()。 for (int i=0;i<10;i++) { if (i == 10-i) break; if (i % 3 != 0) continue; System.out.print(i + " "); }
点击查看答案
第10题
给定代码片段如下所示,则编译运行后,输出结果是()。 for (int i=0;i<10;i++) { if (i == 10-i) break; if (i % 3 != 0) continue; System.out.print(i + " "); }
点击查看答案
第11题
编译如下代码,编译运行时,结果是()? public static void main(String[] atgs){ for(int i=0;i<3;i++){ System.out.print(i); } System.out.print(i); }
A.编译时报错
B.正确运行,输出012
C.正确运行,输出123
D.正确运行,输出0123
点击查看答案