package demo; public class Main { public static void main(String[] args) { Object circle1 = new Circle(); Object circle2 = new Circle(); System.out.println(circle1.equals(circle2)); } } class Circle{ double radius; public boolean equals(Circle circle) { return this.radius == circle.radius; } }
输出为false,就算输错了也可以当做方法重载啊,我用debug来看,根本就没有进入equals怎么回事?
xixiyingyi
相关分类