책 내용 질문하기
2026 실기 문제 11번 코딩오류입니다
도서
2026 시나공 정보처리기사 필기 기본서
페이지
91
조회수
5
작성일
2026-03-09
작성자
최*찬
첨부파일
public class Main {
public static void main(String[] args) {
new Child();
System.out.println(Parent.total);
}
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;
}
}
}
이 경우 컴파일 오류 납니다. 문제 오류 정정해주세요 .
-
최*찬2026-03-09 14:01:14이너클래스는 static 있어야합니다 정오표 정정 글입니다