-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathParcel1.java
More file actions
44 lines (33 loc) · 794 Bytes
/
Parcel1.java
File metadata and controls
44 lines (33 loc) · 794 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
43
44
package innerclasses;
/**
* RUN:
* javac innerclasses/Parcel1.java && java innerclasses.Parcel1
* OUTPUT:
* Tasmania
*/
public class Parcel1 {
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 void ship(String dest) {
Contents c = new Contents();
Destination d = new Destination(dest);
System.out.println(d.readLabel());
}
public static void main(String[] args) {
Parcel1 p = new Parcel1();
p.ship("Tasmania");
}
}