当前位置:网站首页>finalize finalization finally final
finalize finalization finally final
2022-07-03 22:30:00 【Crazy DIU DIU DIU】
finalize
Garbage collector (garbage colector) When you decide to recycle something , Will run the finalize() Method But in Java Unfortunately in China , If there is always enough memory , Then garbage collection may never happen , in other words filalize() May never be implemented , Obviously, it's not reliable to expect it to do the finishing work . that finalize() What is it really about ? Its main purpose is to recycle the memory applied by special channels .Java The program has a garbage collector , So in general, memory problems don't need programmers to worry about . But there is one kind. JNI(Java Native Interface) call non-Java Program (C or C++),finalize() My job is to recycle this part of memory
finally
Java Medium Finally The key is generally related to try Use it together , Before the program enters try After block , Whether the program is terminated due to an exception or by other means ,finally The contents of the block must be executed
finally Block of code and finalize() Method difference
Whether or not an exception is thrown ,finally Code blocks will execute , It is mainly used to release the resources occupied by the application .finalize() The method is Object Class protected Method , It is garbage collected by before the object Java Virtual machine to call
final
- final Literally, it means “ final , The final ”. stay Java It's the same meaning in
- final Can be used to modify variables ( Include class properties 、 Object properties 、 Local variables and formal parameters )、 Method ( Including class methods and object methods ) And the class
- final— Modifier ( keyword ) If a class is declared as final, This means that it can no longer derive new subclasses , Cannot be inherited as a parent class . So a class cannot be declared as abstract Of , It was declared that final Of . Declare a variable or method as final, It can guarantee that they will not be changed in use . Be declared final Must be declared with an initial value , And in the future reference can only read , Do not modify the . Be declared final The same can only be used , Cannot overload
边栏推荐
- 2022 high altitude installation, maintenance and removal of examination question bank and high altitude installation, maintenance and removal of examination papers
- The 2022 global software R & D technology conference was released, and world-class masters such as Turing prize winners attended
- [sg function] lightoj Partitioning Game
- WiFi 2.4g/5g/6g channel distribution
- Bluebridge cup Guoxin Changtian single chip microcomputer -- hardware environment (I)
- Market layout planning and latest dynamic analysis report of China's smart public security industry Ⓕ 2022 ~ 2028
- Blue Bridge Cup Guoxin Changtian MCU -- program download (III)
- Leetcode: a single element in an ordered array
- 股票炒股开户注册安全靠谱吗?有没有风险的?
- Is the account opening of Guotai Junan Securities safe and reliable? How to open Guotai Junan Securities Account
猜你喜欢
Data consistency between redis and database
Harbor integrated LDAP authentication
2 spark environment setup local
2022 electrician (elementary) examination questions and electrician (elementary) registration examination
On my first day at work, this API timeout optimization put me down!
How to solve the problem of requiring a password when accessing your network neighborhood on your computer
Correlation
Blue Bridge Cup Guoxin Changtian MCU -- program download (III)
Exclusive interview with the person in charge of openkruise: to what extent has cloud native application automation developed now?
JS closure knowledge points essence
随机推荐
To rotate 90 degrees clockwise and modify the video format
webAssembly
Unique in China! Alibaba cloud container service enters the Forrester leader quadrant
[actual combat record] record the whole process of the server being attacked (redis vulnerability)
Is the account opening of Guotai Junan Securities safe and reliable? How to open Guotai Junan Securities Account
Market layout planning and latest dynamic analysis report of China's smart public security industry Ⓕ 2022 ~ 2028
Kali2021.4a build PWN environment
2 spark environment setup local
Mysql database - Advanced SQL statement (I)
User login function: simple but difficult
LeetCode 540. A single element in an ordered array
How to solve win10 black screen with only mouse arrow
Redis single thread and multi thread
JS closure knowledge points essence
WFC900M-Network_ Card/Qualcomm-Atheros-AR9582-2T-2R-MIMO-802.11-N-900M-high-power-Mini-PCIe-Wi-Fi-Mod
IPhone development swift foundation 08 encryption and security
Leetcode week 4: maximum sum of arrays (shape pressing DP bit operation)
Buuctf, web:[geek challenge 2019] buyflag
[Android reverse] use the DB browser to view and modify the SQLite database (copy the database file from the Android application data directory | use the DB browser tool to view the data block file)
IPhone development swift foundation 09 assets