求关于抽象类的java 题目,大虾们帮小弟了!!!

来源:百度知道 编辑:UC知道 时间:2024/06/05 02:27:36
编写一个Application程序,程序中包括Fruit、Apple和ExAbstract三个类。其中Fruit类是一个抽象类,包括一个抽象方法outmessage()。Apple类是Fruit类的子类,在其outmessage()方法中输出Apple的一些特征,如颜色、产地、收获季节等。ExAbstract是主类。

**********************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