다음 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());
}
}- ①The Value is 1
- ②The Value is 0
- ③The Value is 10
- ④The Value is 9
선지를 골라 바로 채점해 보세요.
정답 ③
출처: 인사혁신처 공개 기출(공공데이터포털, 이용허락 제한 없음)