java报错symbol_为何此处会出现找不到symbol的错误呢?

使用this不是引用创建的对象么?

import java.util.Comparator;

import java.lang.Comparable;

public class Point implements Comparable {

int x, y;

public final Comparator SLOPE_ORDER = new ByOrder();

private class ByOrder implements Comparator {

public int compare(Point one, Point two) {

return this.slopeTo(one) < this.slopeTo(two) ? -1:

this.slopeTo(one) > this.slopeTo(two) ? 1:0;

}

}

public Point(int x, int y) {

this.x = x;

this.y = y;

}

public void draw() {

StdDraw.circle(x, y, 00);

}

public void drawTo(Point that) {

StdDraw.line(this.x, this.y, that.x, that.y);

}

public String toString() {

String point_string = '(' + String.valueOf(x) + ',' +

String.valueOf(y) + ')';

return point_string;

}

public int compareTo(Point that) {

return ((this.y < that.y) || (this.y == that.y && this.x < that.x)) ? -1:

(this.y > that.y) ? 1:0;

}

public double slopeTo(Point that) {

double slope = (that.y - this.y) / (that.x - this.x);

return slope;

}

}

Point.java:10: error: cannot find symbol return this.slopeTo(one) <

this.slopeTo(two) ? -1:

^ symbol: method slopeTo(Point)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值