0:00

Given the following code segment, which of the following is true?

String s1 = new String("Hi There");
String s2 = new String("Hi There");
String s3 = s1;

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

对于字符串,equals判断内容而==判断是否为同一object。
2

What does the following code print?

System.out.println("13" + 5 + 3);

表达式从左往右执行,所有的+都是连接字符串而非算数加法。
2


陈 欣

AADPS创始人

发表评论