下面的哪些程序片断可能导致错误()
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"
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"
举一反三
- 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";
- 下面的哪些程序片断可能导致错误?( )。 A: String s="Gone with the wind";String t;t=s[3]+"one"; B: String s="Gone with the wind";String t="good";String k=s+t; C: String s="Gone with the wind";String standard=s.toUpperCase(); D: String s="home directory";String t=s-"directory";
- 下面的哪些程序片断可能导致错误?( ) A: String s=”Hello”; String t=,,World"; String k=s+t; B: String s=,,Hello";String t;t=s[3]+"one"; C: String s="Hello,,;String standard = s.tollpperCase(); D: String s="Hello World”;String t=s-”World”;
- 若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 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”));