Skip to content

关于Java OOP中的重写 我不太理解 #16

@hsbt2333

Description

@hsbt2333
注意:

不能重写static静态方法。(形式上可以写,但本质上不是重写,属于下面要讲的隐藏)

重写方法可以改变其它的方法修饰符,如final,synchronized,native。
不管被重写方法中有无final修饰的参数,重写方法都可以增加、保留、去掉这个参数的 final 修饰符(参数修饰符不属于方法签名)。

重写方法可以改变其它的方法修饰符,如final,synchronized,native。final修饰的方法也能重写吗?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions