当前位置:网站首页>Overriding Overloading final
Overriding Overloading final
2022-06-21 21:50:00 【Cabbage is a real dish】
final
Java Of final and C Linguistic const Not very consistent
Java in final Any object used to decorate is declaring its reference immutable , Its value may change , It can be said that Java Medium final Decorated variables are equivalent to pointer constants ( A pointer , Its value is immutable , That is, the address pointed to is immutable )
final Modifier class cannot be inherited
final Modifier methods cannot be overridden , But it can be overloaded
Method signature
Such as public int test(int, long, java.lang.String[])
You can see that the method signature focuses on the method name of the method 、 return type 、 parameter types 、 The order of parameter types , But I don't care about the formal parameter name of the method ( and C Agreement )
Overriding rewrite
Method signature consistent
It is equivalent to overwriting the original method
Such as public int test(int a, long b, String c) and public int test(int d, long e, String f)
Overloading heavy load
Method signatures are inconsistent
A new way
Such as public int test(int a, long b, String c) and public int test(int a)
matters needing attention
In general, it is best to add... When overriding a method in inheritance @Override, Otherwise, it may be inadvertently written as overloaded
边栏推荐
- 天齐锂业通过聆讯:单季净利33亿 蒋卫平夫妇身价超500亿
- 免费又好用的参考文献管理软件zotero该怎么使用?可以同时支持中文和英文吗?...
- #16迭代器经典案例
- 在AD中安装元件和封装库
- 如何解决idea文件被锁Make File Read-Only?
- 9 strategies for improving software development process
- 拖延患者自救指南|“我有不拖延的100种借口,却不愿意跨出一步”
- The latest simulation test questions and answers of Henan construction electrician (special construction operation) in 2022
- Huawei Hongmeng development lesson 3
- Scientific research cartoon | you can learn EEG by looking at the picture. Would you like to try it?
猜你喜欢

Fs9935 high efficiency constant current limiting WLED drive IC

Intelij idea efficient skills (I)

InteliJ-IDEA-高效技巧(二)

Do280openshift command and troubleshooting -- accessing resources and resource types

测评 | 在生活中,你是一位什么样的人呢?

Yanyu saltalk obtained USD 8million round a financing: continue to expand team and market coverage

提升四大性能!D-Wave发布下一代量子退火机原型

华为鸿蒙开发第三课

Synchronous Boost dc/dc converter fs3400 synchronous SOT23-6 small current 500mA boost IC

15 iterator
随机推荐
JS里的数据类型(基础)
类似中国知网但是搜索英文文献的权威网站有哪些?
Tx9116 Synchronous Boost IC
What is gcamp6f? Calcium ion imaging technology.
晶合集成通过注册:拟募资95亿 合肥建投与美的是股东
What is the standard format for writing citations in academic papers?
Hypebeast, un média à la mode, est sur le point d'être lancé: 530 millions de dollars pour le troisième trimestre
Product innovation - an innovative social app that returns to real life
InteliJ-IDEA-高效技巧(一)
JS中的构造函数(重点)
Wechat applet JS converts numbers into letters
搭建Eureka-Server集群
可以在网上炒股开户吗?是安全的吗
从随便到无聊到有病
Yx2811 landscape installation driver IC
怎样有效率地进行外文文献检索?
科研漫画 | 看图可以学脑电,来试试?
Maximum weight matching of bipartite graph (build a board and stick to two questions)
Tx9118 Synchronous Boost IC
Revenue and profit "ebb and flow", water drops turn in pain