void (String s) { class NonCapturingLocalM1 { private final String s; public NonCapturingLocalM1(String s) { this.s = s; } @Override public String toString() { return this.s; } } class CapturingLocalM1 { private final int i; public CapturingLocalM1(int i) { this.i = i; } @Override public String toString() { return s + ":" + i; } } new NonCapturingLocalM1(s).toString(); new CapturingLocalM1(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(); }