一、String类
想要相识一个类,最好的要领就是看这个类的完成源代码,来看一下String类的源码:
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; ........ }
从上面能够看出几点:
1)String类是final类,也即意味着String类不能被继续,而且它的成员要领都默以为final要领。
在Java中,被final润饰的类是不允许被继续的,而且该类中的成员要领都默以为final要领。
2)上面枚举出了String类中所有的成员属性,从上面能够看出String类实际上是经由过程char数组来保留字符串的。
以上就是java中string什么意义的细致内容,更多请关注ki4网别的相干文章!