これは初心者の質問です。JVMの実行は、階層の最下位クラスからメソッド名を検索することから始まり、そのクラスでメソッドが使用できない場合、メソッドを探している親クラスにトラバースすることを読みました。
この場合、継承されたクラスにカスタム ロジックを追加するために "@override" を使用する必要があるのはなぜですか?
以下の例は私の質問を示しています
class superclassA
{
method()
{
}
}
class subclassB extends superclassA
{
@Override
//While executing if JVM starts looking for the method name from the lowest hierarchy
//then why do we have to use "override" as the methodname will be matched from the lowest level itself?
method()
{
--custom subclass specific code...
}
}