您的位置:首页 > 编程语言 > PHP开发

JHTP自测题_第十四章_字符串、字符及正则表达式(Strings, Characters and Regular Expressions)

2016-08-08 21:32 471 查看

Self-Review Exercises

14.1
State whethereach of the following is
true
or
false. If
false, explain why.

a) When
String
objects arecompared using
==, the result is
true
if the
Strings contain thesame values. (False,String objects are compared using operator == to determine
whether they’re the same object in memory.)

b) A
String
can bemodified after it’s created. (False,String objects are immutable and cannot be modified after they’re created.

StringBuilder objects can be modified after they’re created.)

14.2
For each ofthe following, write a single statement that performs the indicated task:

a) Compare the string in
s1
to the stringin
s2
for equality of contents. (s1.equals(s2))

b) Append the string
s2
to the strings1,
using +=. (s1+=s2)

c) Determine the length of the string in
s1. 
(s1.length())

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐