下列选项中,哪个是程序正确的输出结果?()1 class StringDemo{2 public static void main(String[] args){3String s1 = “a”;4String s2 = “b”;5show(s1,s2);6System.out.println(s1+s2);7 }8 public static void show(String s1,String s2){9s1 = s1 +”q”;10s2 = s2 + s1;11 }12 }
A. ab
B. aqb
C. aqbaq
D. aqaqb
查看答案
请说出下列代码的执行结果 :String s = "abcd";String s1 = new String(s);if (s = = s1) System.out.println("the same");if (s.equals(s1)) System.out.println("equals");
A. the same equals
B. equals
C. the same
D. 什么结果都不输出
下列代码的执行结果是什么?String s1 = "aaa";s1.concat("bbb");System.out.println(s1);
A. aaa
B. aaabbb
C. bbbaaa
D. bbb
应用程序的main方法中有以下语句,则输出的结果是 ()。String s = "xxxxxxxxxxxxxxx#123#456#zzzzz";int n = s.indexOf("#");int k = s.indexOf("#", n+1);String s2 = s.substring(n+1, k);System.out.println(s2);
A. 123
B. 123
C. 123456
D. 123
E. 456
F. zzzzz
关于下面的程序Test.java说法正确的是()。public class Test {static String x="1";static int y;public static void main(String args[]) {int z=2;System.out.println(x+y+z);}}
A. 3
B. 12
C. 102
D. 程序有编译错误