主题:请哪路大侠指点一下!
//包1:
package package1;
//接口 面积
public interface shape_area
{
void area();
}
//包2:
package package2;
public abstract class shape
{
abstract void width();
}
//类 rectangle:
import package1.shape_area;
import package2.shape;
class rectangle extends shape implements shape_area
{
public double wid;
public double len;
rectangle(double x,double y)
{
wid=x;
len=y;
}
public void width()
{
System.out.println("The rectangle's area is "+(wid+len)*2);
}
public void area()
{
System.out.println("The rectangle's area is "+wid*len);
}
}
控制台下包1和包2均生成相应的包,但是类编译rectangle出现错误:rectangle不是抽象的,并且未覆盖package2.shape中的抽象方法width()
请问怎么修改?
package package1;
//接口 面积
public interface shape_area
{
void area();
}
//包2:
package package2;
public abstract class shape
{
abstract void width();
}
//类 rectangle:
import package1.shape_area;
import package2.shape;
class rectangle extends shape implements shape_area
{
public double wid;
public double len;
rectangle(double x,double y)
{
wid=x;
len=y;
}
public void width()
{
System.out.println("The rectangle's area is "+(wid+len)*2);
}
public void area()
{
System.out.println("The rectangle's area is "+wid*len);
}
}
控制台下包1和包2均生成相应的包,但是类编译rectangle出现错误:rectangle不是抽象的,并且未覆盖package2.shape中的抽象方法width()
请问怎么修改?