以下程序代码的输出结果是( ) String s=new String("abcdef"),t=new String("123"); System. out. println((concat(s,t)). length());
A: 9
B: 10
C: 6
D: 出错
A: 9
B: 10
C: 6
D: 出错
举一反三
- 下面代码的输出结果是0。 String s = new String(); System.out.println(s.length());
- String s=new String(“hello”);String t =new String(“hello”);char c [ ] ={‘h’,’e’,’l’,’l’,’o’};下列哪些表达式返回true ? A: s.equals(t); B: t.equals(c); C: s= =t ; D: t.equals (new String(“hello”));
- 若String s = “Hello” ; String t = “Hello”;String c=new String(s);则下列哪个表达式返回false?( ) A: s.equals(t); B: t.equals(c); C: s==c; D: s==t;
- 以下程序代码的输出结果为( ) String s1="abc",s2="ab",s3; s3=s2. concat("c"); System. out. println(s1==s3); A: true B: false C: 0 D: 1
- Java中,以下代码会报错会报错的两项是() A: String s = "Gone with the wind"; String t = " good "; String k = s + t; B: String s = "Gone with the wind"; String t; t = s[3] + "one"; C: String s = "Gone with the wind"; String standard = s.toUpperCase(); D: String s = "home directory"; String t = s - "directory";