return new Destination() { private int cost; // Instance initialization for each object: { cost = Math.round(price); if(cost > 100) System.out.println("Over budget!"); } private String label = dest; public String readLabel() { return label; } };
Parcel9 p = new Parcel9(); Destination d = p.dest("Tanzania", 101.395F);