0:00

After the following code is executed, which of I, II and/or III will evaluate to true?

String s1 = "xyz";
String s2 = s1;
String s3 = s2;

I. s1.equals(s3)
II. s1 == s2
III. s1 == s3

三个字符串变量均指向同一object。
1

What is output from the following code?

String s = "AADPS Great!";
String s1 = s.substring(0,7);
String s2 = s1.substring(2);
String s3 = s2.substring(0,3);
System.out.println(s3);
s1AADPS Gs2DPS Gs3DPS
1

Given the following code segment, what is the value of s1 after the code executes?

String s1 = "Hi There";
String s2 = s1;
String s3 = s2;
String s4 = s1;
s2 = s2.toLowerCase();
s3 = s3.toUpperCase();
s4 = null;
s2s3s4分别赋得了新值,但s1仍然保持不变。
4


陈 欣

AADPS创始人

发表评论