具有相同值的字符串常量是由 VM 规范保证使用同一个实例的。
Strings constants with the same value are guaranteed by the VM specification to use the same instance.
这可以完美地工作,代价是需要创建三个长度与文件相同的字符串。
This works perfectly, at the expense of creating three strings that are the length of the file.
我要为大家指出这一点的原因是,如果我们想一下以前讲过的,数据类型的种类,浮点数,整数,字符串,它们实际上有相同的行为方式。
The reason I want to point this out to you is, if we go back up to the kinds of data objects we started with, floats, ints, strings, they actually behave the same way.
应用推荐