[7급 국가직 소프트웨어공학 2021년 10번]

다음 자바 코드에서 오류가 발생하는 문장은?
abstract class Shape {
  public void paint() { draw(); }
  abstract public void draw();
}
abstract class Circle extends Shape {
  public int radius;
  public Circle(int radius) {
    this.radius = radius; }
  double getArea() {
    return (3.14 * radius * radius); }
}
public class NamedCircle extends Circle {
  String name;
  public NamedCircle(int radius, String name) {
    super(radius);
    this.name = name;
  }
  public void draw() {
    System.out.println("반지름이 " + 
                   radius  + "인 원을 그리다.");  
  }
  public static void main(String[] args) {
    Shape s;
    s = new Shape();
    NamedCircle w = new NamedCircle(5, "Ring");
    System.out.println(w.getArea());
    w.draw();
  }
}
소프트웨어공학
  1. ①super(radius);
  2. ②Shape s;
  3. ③s = new Shape();
  4. ④System.out.println(w.getArea());

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

정답 ③

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

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

오류 신고