Change the access modifier of an overridden method in Java?

后端 未结 5 1663
-上瘾入骨i
-上瘾入骨i 2020-12-28 15:32

Is there a reason one can change the access modifier of an overridden method? For instance,

abstract class Foo{
    void start(){...}
}

And

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-28 16:11

    There is only one, you might want the override to be visible by more classes, since no modifier is default, public broadens that.

提交回复
热议问题