当前位置:网站首页>Differences and connections between final and static
Differences and connections between final and static
2022-07-03 12:49:00 【Mcc_ mingchao】
Can modify the class 、 Method 、 Member variables .
static Can modify the code block of the class ,final Can not be .static The decorated code block represents a static code block , When Java virtual machine (JVM) When loading a class , Will execute the code block , Will only be executed once
static You cannot modify a local variable in a method ,final Sure .
static Decorated to indicate static or global , The decorated properties and methods belong to the class , You can use the class name . Static attribute / Method name visit
static Decorated attributes , That is, class variables , It is created and initialized when the class is loaded , It will only be created once
static Modified variables can be reassigned ,static Modified variables if modified , The values of all used object instances have been modified
static You can't use this and super keyword
static Method must be implemented , It can't be abstract abstract
static Method can only be static Methods cover
final Modifier represents constant 、 Once created, it cannot be changed
final The member variable of the tag must be assigned at the same time as the declaration , Or in the constructor of this class , You can't reassign
final Method cannot be overridden by subclass
final Class cannot be inherited , No subclasses ,final The default method in the class is final Of
final Can't be used to decorate a constructor
final Prevent instruction reordering Ensure visibility between threads ( Concurrent )
private Method of type defaults to final Type of
边栏推荐
- Enter the length of three sides of the triangle through the user, and calculate the area of the triangle, where the length is a real number
- [embedded] - Introduction to four memory areas
- Method overloading and rewriting
- Sword finger offer07 Rebuild binary tree
- Apache Mina Development Manual
- [exercise 7] [Database Principle]
- 阿里 & 蚂蚁自研 IDE
- Take you to the installation and simple use tutorial of the deveco studio compiler of harmonyos to create and run Hello world?
- 2020-11_ Technical experience set
- Application of ncnn neural network computing framework in orange school orangepi 3 lts development board
猜你喜欢

Eureka自我保护

2021 autumn Information Security Experiment 1 (password and hiding technology)

剑指Offer07. 重建二叉树

ncnn神經網絡計算框架在香柳丁派OrangePi 3 LTS開發板中的使用介紹

Self made pop-up input box, input text, and click to complete the event.

(最新版) Wifi分销多开版+安装框架

Attack and defense world mobile--ph0en1x-100

强大的头像制作神器微信小程序

Take you to the installation and simple use tutorial of the deveco studio compiler of harmonyos to create and run Hello world?

Detailed explanation of the most complete constraintlayout in history
随机推荐
2020-09_ Shell Programming Notes
Airflow installation jump pit
02_ Lock the code, and don't let the "lock" become a worry
Approve iPad, which wants to use your icloud account
电压环对 PFC 系统性能影响分析
Togaf certification self-study classic v2.0
自抗扰控制器七-二阶 LADRC-PLL 结构设计
如何在微信小程序中获取用户位置?
[exercise 6] [Database Principle]
并网-低电压穿越与孤岛并存分析
The future of cloud computing cloud native
The best shortcut is no shortcut
Swift Error Handling
temp
Apache Mina Development Manual
studio All flavors must now belong to a named flavor dimension. Learn more
Node.js: express + MySQL的使用
idea将web项目打包成war包并部署到服务器上运行
It feels great to know you learned something, isn‘t it?
flinksql是可以直接客户端建表读mysql或是kafka数据,但是怎么让它自动流转计算起来呢?