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
45
46
47
48
49
50
51
|
package pack02;
abstract class Abs{
abstract void disp();
}
class MemberInner {
private int a = 10;
public int b =20;
protected static int c = 30;
public Abs abs = new Abs() {
@Override
void disp() {
// TODO Auto-generated method stub
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
};
/*public void output() {
class Member {
public void disp() {
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}
Member m = new Member();
m.disp();
}*/
}
public class InnerClassAnonymous {
public static void main(String[] args) {
// TODO Auto-generated method stub
/* MemberInner memberinner = new MemberInner();
MwmberInner.Member member = memberinner.new MemberInner();*/
/*MemberInner.Member member = new MemberInner.Member();*/
//member.disp();
//MemberInner memberinner = new MemberInner();
//memberinner.output();
MemberInner memberinner = new MemberInner();
memberinner.abs.disp();
}
}
|
cs |
'Programming > [JAVA]' 카테고리의 다른 글
[JAVA] 단축키 정리 (0) | 2018.03.26 |
---|---|
[JAVA] this call (0) | 2018.03.23 |
[JAVA] Static Inner Class 스태틱 내부 클래스 (0) | 2018.03.23 |
[JAVA] LocalInnerClass 로컬 내부 클래스 (0) | 2018.03.23 |
[JAVA] MemberInnerClass 멤버 내부 클래스 (0) | 2018.03.23 |