duf*_*ymo 11
不,它在Java中不一样.没有空终止符.Java字符串是对象,而不是指向字符数组.它保持长度以及Unicode字符,因此不需要查找空终止符.
您不必在此处询问:查看JDK附带的src.zip中String.java的源代码.这是它的开始:
public final class String
implements java.io.Serializable, Comparable<String>, CharSequence
{
/** The value is used for character storage. */
private final char value[];
/** The offset is the first index of the storage that is used. */
private final int offset;
/** The count is the number of characters in the String. */
private final int count;
/** Cache the hash code for the string */
private int hash; // Default to 0
/** use serialVersionUID from JDK 1.0.2 for interoperability */
private static final long serialVersionUID = -6849794470754667710L;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5033 次 |
| 最近记录: |