-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA.java
More file actions
38 lines (34 loc) · 774 Bytes
/
A.java
File metadata and controls
38 lines (34 loc) · 774 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
package sec02.exam01_nestedclass_object;
/**바깥 클래스**/
class A {
A() { System.out.println("A 객체가 생성됨"); }
/**인스턴스 멤버 클래스**/
public class B {
B() { System.out.println("B 객체가 생성됨"); }
int field1;
//static int field2;
void method1() { }
//static void method2() { }
}
/**정적 멤버 클래스**/
static class C {
C() { System.out.println("C 객체가 생성됨"); }
int field1;
static int field2;
void method1() { }
static void method2() { }
}
void method() {
/**로컬 클래스**/
class D {
D() { System.out.println("D 객체가 생성됨"); }
int field1;
//static int field2;
void method1() { }
//static void method2() { }
}
D d = new D();
d.field1 = 3;
d.method1();
}
}