In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the differences between rewriting Override and reloading Overload in java, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Rewrite (Override)
Rewriting is that the subclass rewrites the implementation of the method that the parent class is allowed to access, and the return value and formal parameters cannot be changed.
The advantage of rewriting is that subclasses can define their own specific behavior as needed. In other words, the subclass can implement the methods of the parent class as needed.
An overridden method cannot throw a new check exception or an exception that is broader than the overridden method declaration.
Overload (Overload)
Overloading (overloading) is in a class with the same method name but different parameters. The return type can be the same or different; note: you cannot judge whether the method is overloaded according to the return value type.
Each overloaded method or constructor must ensure that the type and number of parameters are different.
The difference between rewriting (Override) and overloading (Overload) in java
Distinguishing point rewriting overload English OverridingOverloading definition 1. The method name, parameter type and return value type are all the same; 2. Overridden methods cannot have stricter permissions 1. The name of the method is the same, but the type and number of parameters are different. 2. The scope of no permission requirements occurs in an inheritance class. Thank you for reading this article carefully. I hope the article shared by the editor, "what is the difference between rewriting Override and reloading Overload in java?" is helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.