Java 4일차 Static 활용 테스트

public class StaticTest
{
int normalNum = 10;
static int staticNum = 20;

public static void main(String[] args)
{
StaticTest st1 = new StaticTest();
StaticTest st2 = new StaticTest();

System.out.println(st1.normalNum);
System.out.println(st1.staticNum);
st1.normalNum = 30;
System.out.println(st1.normalNum);
st2.normalNum = 40;
System.out.println(st2.normalNum);
st1.staticNum = 50;
System.out.println(st2.staticNum);
}
}

댓글 없음: