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


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())


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值