listpoint.java
来自「Beginning Java 2, SDK 1.4 Edition Exerci」· Java 代码 · 共 34 行
JAVA
34 行
// Chapter 6 Exercises 1 & 2
public class ListPoint extends Point {
ListPoint next; // Points to next point in the list.
// Constructor to create an object from coordinates:
public ListPoint(double x, double y) {
super(x, y); // Call Point constructor.
next = null; // Set next as end point.
}
// Constructor to create an object from a Point object:
public ListPoint(Point point) {
super(point);
next = null;
}
// Set the pointer to the next ListPoint:
public void setNext(ListPoint next) {
this.next = next;
}
// Get the next point in the list:
public ListPoint getNext() {
return next;
}
// Return class name & coordinates:
public String toString() {
return "ListPoint " + x + "," + y;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?