public class initial{
public static void main(String[] args){
Shape s1 = new rectangle();
Shape s2 = new circle();
s1.getmianji();
s1.getzhouchang();
s2.getmianji();
s2.getzhouchang();
}
}
public static void main(String[] args){
Shape s1 = new rectangle();
Shape s2 = new circle();
s1.getmianji();
s1.getzhouchang();
s2.getmianji();
s2.getzhouchang();
}
}
2017-03-16
public void getzhouchang(){
System.out.println("获取长方形周长");
}
public class circle extends Shape{
public void getmianji(){System.out.println("获取圆形面积");};
public void getzhouchang(){System.out.println("获取圆形周长");};
}
System.out.println("获取长方形周长");
}
public class circle extends Shape{
public void getmianji(){System.out.println("获取圆形面积");};
public void getzhouchang(){System.out.println("获取圆形周长");};
}
2017-03-16
public class rectangle extends Shape{
public void getmianji(){
System.out.println("获取长方形面积");
};
public void getmianji(){
System.out.println("获取长方形面积");
};
2017-03-16
public abstract class Shape{
public abstract void getmianji();
public abstract void getzhouchang();
}
public abstract void getmianji();
public abstract void getzhouchang();
}
2017-03-16