-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathParcel3.java
More file actions
42 lines (31 loc) · 848 Bytes
/
Parcel3.java
File metadata and controls
42 lines (31 loc) · 848 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package innerclasses;
/**
* RUN:
* javac innerclasses/Parcel3.java && java innerclasses.Parcel3
* OUTPUT:
* Destination.label = Tanzania
*/
public class Parcel3 {
class Contents {
private int i = 11;
public int value() { return i; }
}
class Destination {
private String label;
Destination(String whereTo) {
label = whereTo;
}
String readLabel() {
return label;
}
public String toString() {
return getClass().getSimpleName()+".label = "+label;
}
}
public static void main(String[] args) {
Parcel3 p = new Parcel3();
Parcel3.Contents c = p.new Contents();
Parcel3.Destination d = p.new Destination("Tanzania");
System.out.println(d);
}
}