对不对 符合作业题意么
父类
package cxl.lxb;
public abstract class Shape {
public abstract void mianji();
public abstract void zhouchang();
}
子类
package cxl.lxb;
public class Rectangle extends Shape {
@Override
public void mianji() {
// TODO Auto-generated method stub
double sum=40;
System.out.println("矩形面积为"+sum);
}
@Override
public void zhouchang() {
// TODO Auto-generated method stub
int;
System.out.println("矩形周长为"+lang);
}
}
子类
package cxl.lxb;
public class Circle extends Shape {
@Override
public void mianji() {
// TODO Auto-generated method stub
double sum=90;
System.out.println("圆形面积为"+sum);
}
@Override
public void zhouchang() {
// TODO Auto-generated method stub
double;
System.out.println("圆形周长为"+lang);
}
}
入口类
package cxl.lxb;
public class Initail {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Shape sha=new Rectangle();
sha.mianji();
sha.zhouchang();
Shape sha1=new Circle();
sha1.mianji();
sha1.zhouchang();
}
}