⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apple.java

📁 java语言中简单工厂模式的例子
💻 JAVA
字号:
//Source file: D:\\javaproject\\DesignPattern\\StaticFactoryPattern\\Apple.java


public class Apple implements Fruit 
{
   private int treeAge;
   
   /**
    * @roseuid 41A0891D004E
    */
   public Apple() 
   {
    
   }
   
   /**
    * @param treeAge
    * @roseuid 41A087CC0138
    */
   public void setTreeAge(int treeAge) 
   {
    this.treeAge=treeAge;
   }
   
   /**
    * @return int
    * @roseuid 41A087EF0119
    */
   public int getTreeAge() 
   {
    return this.treeAge;
   }
   
   /**
    * @roseuid 41A0891D006D
    */
   public void grow() 
   {
    log("Apple is growing...");
   }
   
   /**
    * @roseuid 41A0891D008C
    */
   public void harvest() 
   {
    log("Apple has been harvested.");
   }
   
   /**
    * @roseuid 41A0891D009C
    */
   public void plant() 
   {
    log("Apple has been planted.");
   }
   
   public static void log(String msg)
   {
   	System.out.println(msg);
   }
}

⌨️ 快捷键说明

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