point.java

来自「Java2入门经典第二章源码」· Java 代码 · 共 27 行

JAVA
27
字号
public class Point
{
  // Create a point from its coordinates
  public Point(double xVal, double yVal)
  {
     x = xVal;
     y = yVal;
  }

  // Create a point from another point
  public Point(Point point)
  {
     x = point.x;
     y = point.y;
  }

  // Convert a point to a string
  public String toString()
  { 
     return x+","+y; 
  }

  // Coordinates of the point
  protected double x;
  protected double y;
}

⌨️ 快捷键说明

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