정보처리기사 실기 · 2025년 1회 · 18번

Q.182025년1회10과목 · Java배점 5점
아래 코드의 출력값을 작성하시오.
class Parent {
    static int total = 0;
    int v = 1;
    public Parent() {
        total += (++v); show();
    }
    public void show() {
        total += total;
    }
}
class Child extends Parent {
    int v = 10;
    public Child() {
        v += 2; total += v++; show();
    }
    @Override
    public void show() {
        total += total * 2;
    }
}
public class Main {
    public static void main(String[] args) {
        new Child();
        System.out.println(Parent.total);
    }
}

이 문제는 풀이 화면에서 직접 실행해 풀 수 있어요.

이 회차 문제 풀어보기 →정보처리기사 실기 더 풀기