20 lines
550 B
Java
20 lines
550 B
Java
//: innerclasses/Parcel9.java
|
|
// An anonymous inner class that performs
|
|
// initialization. A briefer version of Parcel5.java.
|
|
|
|
public class Parcel9 {
|
|
// Argument must be final to use inside
|
|
// anonymous inner class:
|
|
public Destination destination(final String dest) {
|
|
return new Destination() {
|
|
private String label = dest;
|
|
@Override
|
|
public String readLabel() { return label; }
|
|
};
|
|
}
|
|
public static void main(String[] args) {
|
|
Parcel9 p = new Parcel9();
|
|
Destination d = p.destination("Tasmania");
|
|
}
|
|
} ///:~
|