다음 자바 코드에서 오류가 발생하는 문장은?
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();
}
}- ①super(radius);
- ②Shape s;
- ③s = new Shape();
- ④System.out.println(w.getArea());
선지를 골라 바로 채점해 보세요.
정답 ③
출처: 인사혁신처 공개 기출(공공데이터포털, 이용허락 제한 없음)