Declare two variables of type MyPoint called: start and end. Assign both of these variables a new MyPoint object
声明两个type Mypoint的变量:Start和End,为这两个变量分配一个新MyPoint对象
参考如下:
class MyPoint {
int x;
int y;
public MyPoint(int x, int y) {
this.x = x;
this.y = y;
}
@Override
public String toString() {
return "MyPoint{" +
"x=" + x +
", y=" + y +
'}';
}
}
public class Main {
public static void main(String[] args) {
MyPoint start = new MyPoint(20, 30);
MyPoint end = new MyPoint(40, 50);
System.out.println(start);
System.out.println(end);
}
}