프로그래밍 언어 활용난도 중상
13번 · 주관식 · 5점
다음 Java 프로그램의 실행 결과를 쓰시오.
public class Main {
public static void main(String[] args) {
new Derived();
System.out.println(Base.total);
}
}
class Base {
static int total = 0;
int value = 1;
Base() {
total += ++value;
update();
}
void update() {
total += total;
}
}
class Derived extends Base {
int value = 10;
Derived() {
value += 2;
total += value++;
update();
}
@Override
void update() {
total += total * 2;
}
}