01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package basics.inner.two;
public class Main {
private Main() {}
static public void main (final String[] args) {
//stdlib.Trace.graphvizShowSteps (true); stdlib.Trace.run ();
C mc1 = new C(42);
C mc2 = new C(36);
mc1.f();
mc2.f();
}
}
interface Print { void print(); }
class C {
int cx;
C(int x) { cx = x; }
void f() {
Print p = new Print() {
int py = 27;
public void print() {
System.out.println(" cx=" + cx + " py=" + py);
}
};
p.print();
}
}
|