void () { String s = ""; class NonCapturingLocalR2 { private final String s; public NonCapturingLocalR2(String s) { this.s = s; } @Override public String toString() { return this.s; } } class CapturingLocalR1 { private final int i; public CapturingLocalR1(int i) { this.i = i; } @Override public String toString() { return s + ":" + i; } } new NonCapturingLocalR2(s).toString(); new CapturingLocalR1(42).toString(); Callable<String> c1 = new Callable<String>() { @Override public String call() { return null; } }; Callable<String> c2 = new Callable<String>() { @Override public String call() { return s; } }; (c1.call() + c2.call()).length(); }