請問一下,我要印出Apple has been planted,Apple is growing,...,Strawberry has been harvested;該修改哪裡??
class Apple{
private int treeAge;
public void plant(){
System.out.println("Apple has been planted");
}
public void grow(){
System.out.println("Apple is growing");
}
public void harvest(){
System.out.println("Apple has been harvested");
}
public int getTreeAge(){
return this.treeAge ;
}
public void setTreeAge (int treeAge) {
this.treeAge= treeAge;
}
}
class Grape{
private boolean seedless;
public void plant(){
System.out.println("Grape has been planted");
}
public void grow(){
System.out.println("Grape is growing");
}
public void harvest(){
System.out.println("Grape has been harvested");
}
public boolean getseedless(){
return this.seedless;
}
public void setseedless(boolean seedless){
this.seedless = seedless;
}
}
class Strawberry{
public void plant(){
System.out.println("Strawberry has been planted");
}
public void grow(){
System.out.println("Strawberry is growing");
}
public void harvest(){
System.out.println("Strawberry has been harvested");
}
}
public class java{
void main(){
Apple apple = new Apple();
Grape grape = new Grape();
Strawberry strawberry = new Strawberry();
}
}