java - String s = new String("xyz");创建了几个String Object?
黄舟
黄舟 2017-04-18 09:32:25
0
3
1375
黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(3)
刘奇

If there is xyzthis object in your string constant pool, one object is created
If not, two objects are created

左手右手慢动作

First check if there is 'xyz' in the constant pool. If not, create it.
Then create a new String whose reference points to xyz in the constant pool.
So there are 1 or 2.

迷茫

Two objects are created

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template