<分区>
我是 Java 新手,我试图理解 Oracle 网站教程中的以下行:https://docs.oracle.com/javase/tutorial/java/IandI/final.html
Methods called from constructors should generally be declared final. If a constructor calls a non-final method, a subclass may redefine that method with surprising or undesirable results.
我尝试多次阅读它,试图理解子类如何重新定义从构造函数调用的方法。我是否应该假设构造函数调用的方法是在构造函数的类中声明的方法?如果一个方法是从构造函数中调用的,为什么要将其声明为 final 呢? (而不是在嵌套类中或在另一个方法中?)我无法理解该声明。一个例子会很棒。