class OuterClass {

private static String myName;

private static int num;


OuterClass(String name) {

myName = name;

num = 0;

}


static class StaticInnerClass {

public StaticInnerClass(String name) {

// TODO Auto-generated constructor stub

myName = name;

num = 0;

}


public void inner() {

num++;

System.out.println(myName + " OuterClass " + num);

}


}


class InnerClassTest {

public static void main(String[] args) {

// static

StaticInnerClass staticin1 = new StaticInnerClass("First");

StaticInnerClass staticin2 = new StaticInnerClass("Second");

staticin1.inner();

staticin2.inner();


}

}

블로그 이미지

왕왕왕왕

,