[7급 국가직 프로그래밍언어론 2009년 18번]

다음 Java 프로그램의 수행 결과는?
public class C {
    private static int num = 0;
    protected static int get() {
        return num;
    }
    private static void add() {
        num++;
    }
    C() {
        C.add();
    }
    public static void main(String args[]) {
        for (int i=0; i<10; ++i)
            new C();
        System.out.println("The Value is " + C.get());
    }
}
프로그래밍언어론
  1. ①The Value is 1
  2. ②The Value is 0
  3. ③The Value is 10
  4. ④The Value is 9

선지를 골라 바로 채점해 보세요.

정답 ③

출처: 인사혁신처 공개 기출(공공데이터포털, 이용허락 제한 없음)

신고가 접수됐습니다. 감사합니다.

오류 신고