方法声明包括' this'作为变量名称

时间:2017-11-16 17:17:52

标签: java

我发现以下代码编译(Java 8),尽管参数数量错误并且使用了保留关键字'这个'。

public interface Comparable<T> {
    public int compareTo(T o);
}


public class Person implements Comparable<Person> {

    @Override
    public int compareTo(Person this, Person other) {
        return 0;
    }
}

这种行为的原因是什么?欢迎任何代码示例。

0 个答案:

没有答案