public class MainClass {
class A {
private int i = 11;
public int value() {
return i;
}
}
class B {
private String label;
B(String whereTo) {
label = whereTo;
}
String readLabel() {
return label;
}
}
// Using inner classes looks just like
// using any other class, within MainClass:
public void ship(String dest) {
A c = new A();
B d = new B(dest);
System.out.println(d.readLabel());
}
public static void main(String[] args) {
MainClass p = new MainClass();
p.ship("AAA");
}
}
|