JAVA좀 잘하시는분 ㅠㅠ 헬프미!!

학교 과제인데 도저히 해결이 안돼서여ㅠㅠ아나 지식인이고 뭐고 주위사람들까지 다 물어봐도 모르겠다고 하니;;상속인데 관련 예제인데 도무지 이게 실행이 안되네여

어디가 문제인지를 모르겠어요 오류가 마지막에
GraphicsProgram 선언하면서 나는듯한데

수정방안을 못찾겠네여

import java.awt.*;
abstract class Shape {
protected Color color;
protected int x;
protected int y;

protected Shape(Color c,int x,int y){
color=c;
this.x=x;
this.y=y;
}
public abstract void draw();
}
class Rectangle extends Shape{
private int width;
private int height;
public Rectangle(Color c,int x,int y,int width,int height){
super(c,x,y);
this.width=width;
this.height=height;
}
public void draw(){
System.out.println(Rectangle: +x+,+y+,+width+,+height);
}
}
class Circle extends Shape{
private int radius;
public Circle(Color c,int x,int y,int radius){
super(c,x,y);
this.radius=radius;
}
public void draw(){
System.out.println(Circle: +x+,+y+,+radius);

}
}
public class GraphicsProgram{
public static void main(String args[]){
Shape s1 =new Rectangle(Color.red,0,5,200,300);
Shape s2 =new Circle(Color.green,20,30,100);

s1.draw();
s2.draw();
}
}

탈모고민 다른 글

목록