关于java的new对象问题
关于java的new对象问题
日期:2021-05-24 04:43:57 人气:1
你好,修改后的代码如下,关键处我做了注释。
class Point {
int x,y;
public Point(){}
public Point(int x, int y){
this.x = x;
this.y = y;
}
}
public class Circle {
private Point center = new Point(); //记得实例化这个的.
class Point {
int x,y;
public Point(){}
public Point(int x, int y){
this.x = x;
this.y = y;
}
}
public class Circle {
private Point center = new Point(); //记得实例化这个的.