client.java

来自「java与模式 一书的源码」· Java 代码 · 共 26 行

JAVA
26
字号
package com.javapatterns.prototype.panda;

public class Client
{
    private static PandaToClone thisPanda , thatPanda;

    public static void main(String[] args)
    {
       thisPanda = new PandaToClone(15, 25);
       thisPanda.setAge(3);

       // Create the second object by cloning the first
       thatPanda = (PandaToClone) thisPanda.clone();

      // Now describe these objects on the system console :

      System.out.println(" Age of this panda : " + thisPanda.getAge());
      System.out.println("            height : " + thisPanda.getHeight());
      System.out.println("            weight : " + thisPanda.getWeight());
      System.out.println(" Age of that panda : " + thatPanda.getAge());
      System.out.println("            height : " + thatPanda.getHeight());
      System.out.println("            weight : " + thatPanda.getWeight());
   }

}

⌨️ 快捷键说明

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