59 给定以下代码,哪些语句的结果不为 true String s1 = “hello” ; String s2 = “hello” ; String s3 = new String(“hello”) ; char[] c = {‘h’,’e’,’l’,’l’,’o’}; String s4 = new String(c);
A: s1.equals(s2)
B: s3.equals(s4)
C: s1==s2
D: s3==s4
A: s1.equals(s2)
B: s3.equals(s4)
C: s1==s2
D: s3==s4
举一反三
- 以下代码共创建了几个对象?String s1=new String("hello");String s2=new String("hello");String s3=s1;String s4=s2; A: 2 B: 4 C: 1 D: 3
- 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=new String(“hello”); String t =new String(“hello”); char c [ ] ={‘h’,’e’,’l’,’l’,’o’}; 下列哪些表达式返回true ?
- 下列代码片段执行结果是:String s=new String(”abc”); String s1=new String(s); if(s==s1){ System.out.println(”Hello”); } if(s.equals(s1)){ System.out.println(”World”); } A: Hello World B: Hello C: World D: Null
- 请说出下列代码的执行结果 : String s = "abcd"; String s1 = new String(s); if (s = = s1) System.out.println("the same"); if (s.equals(s1)) System.out.println("equals");