📄 listpoint.java
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -