当前位置:网站首页>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
边栏推荐
- What is more elegant for flutter to log out and confirm again?
- [review questions of database principles]
- Summary of error prone knowledge points: Calculation of define s (x) 3*x*x+1.
- Day 1 of kotlin learning: simple built-in types of kotlin
- elastic_ L04_ introduction. md
- idea将web项目打包成war包并部署到服务器上运行
- 01_ Using the concurrent tool class library, is thread safety safe
- The future of cloud computing cloud native
- Apache Mina开发手册
- Do you feel like you've learned something and forgotten it?
猜你喜欢
剑指Offer10- I. 斐波那契数列
How to convert a decimal number to binary in swift
idea将web项目打包成war包并部署到服务器上运行
Method overloading and rewriting
最新版盲盒商城thinkphp+uniapp
强大的头像制作神器微信小程序
Cloud Computing future - native Cloud
Xctf mobile--rememberother problem solving
Implement verification code verification
studio All flavors must now belong to a named flavor dimension. Learn more
随机推荐
[review questions of database principles]
[exercise 7] [Database Principle]
Record your vulnhub breakthrough record
T430 toss and install OS majave 10.14
Ten workplace rules
The latest version of blind box mall thinkphp+uniapp
ORM use of node -serialize
Analysis of a music player Login Protocol
Differences between initial, inherit, unset, revert and all
Alibaba is bigger than sending SMS (user microservice - message microservice)
01_ Using the concurrent tool class library, is thread safety safe
Apache Mina Development Manual
Attack and defense world mobile--ph0en1x-100
Glide 4.6.1 API initial
Airflow installation jump pit
Low code platform international multilingual (I18N) technical solution
GaN图腾柱无桥 Boost PFC(单相)七-PFC占空比前馈
【数据挖掘复习题】
Flinksql can directly create tables and read MySQL or Kafka data on the client side, but how can it automatically flow and calculate?
十條職場規則