client.java

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

JAVA
33
字号
package com.javapatterns.prototype.bike;

public class Client
{
    CloneableBike first;
    CloneableBike second;

   public static void main(String[] args)
   {
      // Create two CloneableBike class object references

      CloneableBike first, second;

      // Create the first bike object from scratch

      first = new CloneableBike(4,26);
      first.setAge(3);

      // Create the second bike object by cloning the first

      second = (CloneableBike) first.clone();

      // Now describe these bikes on the system console :

      System.out.println(" First bike age : "+first.getAge());
      System.out.println("          gears : "+first.getGears());
      System.out.println("     wheel size : "+first.getWheelSize());
      System.out.println("Second bike age : "+second.getAge());
      System.out.println("          gears : "+second.getGears());
      System.out.println("     wheel size : "+second.getWheelSize());
   }
}

⌨️ 快捷键说明

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