-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParcel10.java
More file actions
27 lines (23 loc) · 565 Bytes
/
Parcel10.java
File metadata and controls
27 lines (23 loc) · 565 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package chapter10;
import org.omg.CORBA.PRIVATE_MEMBER;
public class Parcel10 {
public Destination destination(final String dest,final float price){
return new Destination(){
private int cost;
{
cost = Math.round(price);
if(cost > 100){
System.out.println("Over budget!");
}
}
private String label = dest;
public String readLabel(){
return label;
}
};
}
public static void main(String[] args) {
Parcel10 p = new Parcel10();
Destination d = p.destination("Tasmania", 101.395F);
}
}