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