Here is an excerpt from JDK7 source code:
public String(String original) {
this.value = original.value;
this.hash = original.hash;
}
Both value
and hash
are private
field. Why is original.value
legal?
See this table:
Access Levels
Modifier | Class | Package | Subclass | World
-------------+--------+-----------+-----------+--------
public | Y | Y | Y | Y
protected | Y | Y | Y | N
no modifier | Y | Y | N | N
private | Y ← | N | N | N
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With