Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hsbt2333 opened this issue Nov 9, 2021 · 0 comments
Open

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

hsbt2333 opened this issue Nov 9, 2021 · 0 comments

Comments

@hsbt2333
Copy link

hsbt2333 commented Nov 9, 2021

注意:

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

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant