求关于抽象类的java 题目,大虾们帮小弟了!!!
来源:百度知道 编辑:UC知道 时间:2024/06/05 02:27:36
**********************Fruitjava****************************
public abstract class Fruit {
abstract public void outmessage();
}
**********************Apple.java****************************
public class Apple extends Fruit {
private String color;
private String productingArea;
private String crown;
public Apple() {
this.color = "red";
this.productingArea = "China";
this.crown = "Autumn";
}
public void outmessage() {
System.out.println("The color of the apple is " + color);
System.out.println("The producting area of the apple is " + productingArea);
System.out.println("The color of the apple is " + crown);
}
public String getColor() {
return color;
}
public void setColor(St