trypoints.java

来自「Usefull sample codes for Java. Containt 」· Java 代码 · 共 33 行

JAVA
33
字号
import java.awt.*;

class TryPoints {
    public static void main(String[] arguments) {
        Point object1 = new Point(11,22);
        Point3D object2 = new Point3D(7,6,64);

        System.out.println("The 2D point is located at (" + object1.x
            + ", " + object1.y + ")");
        System.out.println("\tIt's being moved to (4, 13)");
        object1.move(4,13);
        System.out.println("The 2D point is now at (" + object1.x
            + ", " + object1.y + ")");
        System.out.println("\tIt's being moved -10 units on both the x "
            + "and y axes");
        object1.translate(-10,-10);
        System.out.println("The 2D point ends up at (" + object1.x
            + ", " + object1.y + ")\n");

        System.out.println("The 3D point is located at (" + object2.x
            + ", " + object2.y + ", " + object2.z +")");
        System.out.println("\tIt's being moved to (10, 22, 71)");
        object2.move(10,22,71);
        System.out.println("The 3D point is now at (" + object2.x
            + ", " + object2.y + ", " + object2.z +")");
        System.out.println("\tIt's being moved -20 units on the x, y "
            + "and z axes");
        object2.translate(-20,-20,-20);
        System.out.println("The 3D point ends up at (" + object2.x
            + ", " + object2.y + ", " + object2.z +")");
    }
}

⌨️ 快捷键说明

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