Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between Overload and Override in java

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "what is the difference between Overload and Override in java". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "what is the difference between Overload and Override in java".

The difference between Overload and Override

Overloaded Overload means that there can be multiple methods with the same name in the same class, but these methods have different parameter lists, that is, different parameter parameters or parameter types. Of course, the return values can be different when overloaded, but if the parameter list is exactly the same, you cannot overload through inconsistent return types, which is not allowed.

Overriding Override means that the method in the subclass can have exactly the same name and parameters as the method in the parent class. When this method is called through an object created by the subclass, the method defined in the subclass is called, that is, the method in the subclass overrides the method of the parent class. When a subclass overrides a parent method, it can only throw fewer or smaller exceptions than the parent class. The return of the overridden method must be consistent with that of the overridden method.

What are the basic data types of java? the basic data types of Java can be divided into: 1. Integer types, which are used to represent the data types of integers. 2. Floating point type, which is used to represent the data type of decimals. 3. Character type. The keyword of character type is "char". 4. Boolean type, which is the basic data type that represents logical values.

The above is all the content of the article "what's the difference between Overload and Override in java". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report