publicclass MainClass {
privatevoid method(boolean b) {
if (b) {
class A {
private String id;
A(String s) {
id = s;
}
String getSlip() {
return id;
}
}
A ts = new A("slip");
String s = ts.getSlip();
}
// Can't use it here! Out of scope:
// ! A ts = new A("x");
}
publicvoid track() {
method(true);
}
publicstaticvoid main(String[] args) {
MainClass p = new MainClass();
p.track();
}
}