public class MainClass {
public A dest(final String dest, final float price) {
return new A() {
private int cost;
{
cost = 100;
System.out.println("Over budget!");
}
private String label = dest;
public String readLabel() {
return label;
}
};
}
public static void main(String[] args) {
MainClass p = new MainClass();
A d = p.dest("A", 101.395F);
}
}
interface A {
String readLabel();
}
|