playingpoints.java

来自「Java Classic Examples是我买的两本书:《JAVA经典实例》和」· Java 代码 · 共 24 行

JAVA
24
字号
import java.awt.*;

public class PlayingPoints
{
  public static void main(String[] args)
  {
    Point aPoint = new Point();             // Initialize to 0,0
    Point bPoint = new Point(50,25);
    Point cPoint = new Point(bPoint);
    System.out.println("aPoint is located at: " + aPoint);

    aPoint.move(100,50);                    // Change to position 100,50

    bPoint.x = 110;
    bPoint.y = 70;

    aPoint.translate(10,20);                // Move by 10 in x and 20 in y
    System.out.println("aPoint is now at: " + aPoint);

    if(aPoint.equals(bPoint))
      System.out.println("aPoint and bPoint are at the same location.");
  }
}

⌨️ 快捷键说明

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