hirthwork

Продолжение #tsxtz
sapienti sat

$ cat Main.java
import java.lang.reflect.Field;

public class Main {
    public static void main(final String... args) throws Exception {
        Field f = String.class.getDeclaredField("value");
        f.setAccessible(true);
        StringBuilder sb = new StringBuilder("hello, world");
        String s1 = new String(sb);
        String s2 = new String(sb);
        Object v1 = f.get(s1);
        Object v2 = f.get(s2);
        System.out.println(v1 == v2);
    }
}

$ javac Main.java
$ java Main
false
$ /opt/ibm/javawrt3_64/bin/java Main
true