当前位置:网站首页>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
边栏推荐
- Preliminary analysis of smart microwave radar module
- 320. Energy Necklace (ring, interval DP)
- Plug - in Oil Monkey
- Programming language (1)
- 1 Introduction to spark Foundation
- [dynamic planning] counting garlic customers: the log of garlic King (the longest increasing public subsequence)
- Pooling idea: string constant pool, thread pool, database connection pool
- In 2022, 6G development has indeed warmed up
- C deep anatomy - the concept of keywords and variables # dry inventory #
- SDMU OJ#P19. Stock trading
猜你喜欢

C deep anatomy - the concept of keywords and variables # dry inventory #

On my first day at work, this API timeout optimization put me down!

2022 safety officer-a certificate registration examination and summary of safety officer-a certificate examination

Pan Yueming helps Germany's Rochester Zodiac custom wristwatch

Niuke winter vacation training camp 4 g (enumeration optimization, Euler power reduction)

Exclusive interview with the person in charge of openkruise: to what extent has cloud native application automation developed now?

The latest analysis of R1 quick opening pressure vessel operation in 2022 and the examination question bank of R1 quick opening pressure vessel operation

Summary of fluent systemchrome
![[dynamic planning] counting garlic customers: the log of garlic King (the longest increasing public subsequence)](/img/29/543dce2f24130d22c1824385fbfa8f.jpg)
[dynamic planning] counting garlic customers: the log of garlic King (the longest increasing public subsequence)

STM32 multi serial port implementation of printf -- Based on cubemx
随机推荐
How to store null value on the disk of yyds dry inventory?
Supply and demand situation and market scale calculation report of China's portable energy storage power PES industry Ⓛ 2022 ~ 2028
Exclusive interview with the person in charge of openkruise: to what extent has cloud native application automation developed now?
2022 safety officer-b certificate examination summary and safety officer-b certificate simulation test questions
IPhone development swift foundation 09 assets
Preliminary analysis of smart microwave radar module
Redis single thread and multi thread
How to connect a laptop to a projector
The 14th five year plan for the construction of Chinese Enterprise Universities and the feasibility study report on investment Ⓓ 2022 ~ 2028
Investment planning analysis and prospect prediction report of China's satellite application industry during the 14th five year plan Ⓑ 2022 ~ 2028
[sg function]split game (2020 Jiangxi university student programming competition)
Niuke winter vacation training camp 4 g (enumeration optimization, Euler power reduction)
Correlation
On my first day at work, this API timeout optimization put me down!
How to switch between dual graphics cards of notebook computer
[Android reverse] use DB browser to view and modify SQLite database (download DB browser installation package | install DB browser tool)
[golang] leetcode intermediate - alphabetic combination of island number and phone number
pivot ROP Emporium
Cesium terrain clipping draw polygon clipping
Programming language (2)