当前位置: 技术问答>java相关
一道java的题目,应该不难,进来看一下
来源: 互联网 发布时间:2017-03-11
本文导语: Which of the following statements are true? 1 A String created with the new keyword will cause a new String object to be created. 2 A String reference created without the new keyword will not necessarily cause a new String object to...
Which of the following statements are true?
1 A String created with the new keyword will cause a new String object to be created.
2 A String reference created without the new keyword will not necessarily cause a new String object to be created
3 Once created, the value of a String object cannot be changed
4 The value of a String object can be changed using the setValue method.
The Correct Answer is
1)
2)
偶觉得3)也对,谁能解释一下为什么
1 A String created with the new keyword will cause a new String object to be created.
2 A String reference created without the new keyword will not necessarily cause a new String object to be created
3 Once created, the value of a String object cannot be changed
4 The value of a String object can be changed using the setValue method.
The Correct Answer is
1)
2)
偶觉得3)也对,谁能解释一下为什么
|
the value of a String object 指的是该String object在Heap中的内存地址。是由JVM分配的,是固定的不能被更改。
|
是SCJP模拟题吧
答案不对是常事
答案不对是常事
|
3正确吧...
|
它的说明本来就认为3也是个正确结果啊。
|
对