public class MainClass {
public A dest(String s) {
class B implements A {
private String label;
private B(String whereTo) {
label = whereTo;
}
public String readLabel() {
return label;
}
}
return new B(s);
}
public static void main(String[] args) {
MainClass p = new MainClass();
A d = p.dest("A");
}
}
interface A {
String readLabel();
}
|