apple.java

来自「《Java与模式》一书的源代码」· Java 代码 · 共 33 行

JAVA
33
字号
package com.javapatterns.factorymethod.farm;

public class Apple implements Fruit
{
    private int treeAge;

    public void grow()
    {
        System.out.println("Apple is growing...");
    }

    public void harvest()
    {
        System.out.println("Apple has been harvested.");
    }

    public void plant()
    {
        System.out.println("Apple has been planted.");
    }

    public int getTreeAge()
    {
        return treeAge;
    }

    public void setTreeAge(int treeAge)
    {
        this.treeAge = treeAge;
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?