Inheritance and polymorphism in Java

Inheritance and polymorphism

I This super keyword

1.this:

2.super:

II Override of method:

The subclass re implements the same method as the parent class Access modifiers and exceptions must be at least the same as or larger than the scope of the parent class

III Method overload:

The same method has different parameter lists with different names

IV Polymorphism:

Reference variables in java have compile - time and run - time types The compile time type is determined by the type when the variable is declared, and the runtime type is determined by the type actually assigned to the variable If the compile - time type is inconsistent with the run - time type, polymorphism will occur

Thank you for reading, hope to help you, thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>