I cannot understand the code in jdk1.7. value is private, so why can the code use it with e.g. anotherString.value?
public final class String
implements java.io.Serializable, Comparable<String>, CharSequence {
/** The value is used for character storage. */
private final char value[];
/** Cache the hash code for the string */
private int hash; // Default to 0
public int compareTo(String anotherString) {
int len1 = value.length;
int len2 = anotherString.value.length;//cannot understand
int lim = Math.min(len1, len2);
char v1[] = value;
char v2[] = anotherString.value;
//.....
}