Can we use final key word to a finalize method | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can we use final key word to a finalize method

14th Nov 2019, 4:47 PM
Chethan Vegeta
Chethan Vegeta - avatar
2 Answers
+ 2
I'm not sure but the finalize method is protected and non static so it is meant to be overridden when required and as you know a final method cannot be over ridden. Please correct me if I'm wrong.
14th Nov 2019, 5:04 PM
Avinesh
Avinesh - avatar
+ 2
Here is a code with some examples: https://code.sololearn.com/cfWcx53T6zZc/?ref=app Most important: it is not possible to override a final method. Read also: https://docs.oracle.com/javase/tutorial/java/IandI/final.html Btw: also classes can be final
14th Nov 2019, 8:45 PM
Denise Roßberg
Denise Roßberg - avatar