此方法是重载、覆盖还是 none?

Is this method overloading, overriding or none?

Difference between method overloading and overriding in java?没有给出正确答案。下面是 java 代码。

Parent class

public class Parent {
    void display() {
        // some code
    }
}

Child class

public class child extends Parent
    void display(int a) {
        // some code
    }
}

问题:此方法是否重载、覆盖或none?

这是超载

Method Overloading - method in Same Class or different class

Method Overriding - method both in Parent Child class

这里的方法在父类和子类中都有不同的签名class

这是超载(在 child 中),因为 JLS 8.4.9:

If two methods of a class (whether both declared in the same class, or both inherited by a class, or one declared and one inherited) have the same name but signatures that are not override-equivalent, then the method name is said to be overloaded.