points.java

来自「基于netbeans的java桌面应用程序合集」· Java 代码 · 共 57 行

JAVA
57
字号
package com.sun.tiger.news;

class Point2D {
    protected int x, y;
    
    public Point2D() {
        this.x=0;
        this.y=0;
    }
    
    public Point2D(int x, int y) {
        this.x = x;
        this.y = y;
    }
}

class Point3D extends Point2D {
    protected int z;
    
    public Point3D(int x, int y) {
        this(x, y, 0);
    }
    
    public Point3D(int x, int y, int z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }
}

class Position2D {
    Point2D location;
    
    public Position2D() {
        this.location = new Point2D();
    }
    
    public Position2D(int x, int y) {
        this.location = new Point2D(x, y);
    }
    
    public Point2D getLocation() {
        return location;
    }
}

class Position3D extends Position2D {
    Point3D location;
    
    public Position3D(int x, int y, int z) {
        this.location = new Point3D(x, y, z);
    }
    
    public Point3D getLocation() {
        return location;
    }
}

⌨️ 快捷键说明

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