What is Final keyword in java | Method,Class , Variable | OOP | Most Asked Interview Question

preview_player
Показать описание
final Keyword:
A field can be declared as final. Doing so prevents its contents from being modified, making it, essentially, a constant.
This means that you must initialize a final field when it is declared.

It is a common coding convention to choose all uppercase identifiers for final fields:
final int FILE_OPEN = 2;

Unfortunately, final guarantees immutability only when instance variables are primitive types, not reference types.
If an instance variable of a reference type has the final modifier, the value of that instance variable (the reference
to an object) will never change—it will always refer to the same object—but the value of the object itself can change.
Рекомендации по теме
Комментарии
Автор

I rarely use final keyword. This video open my eyes. Thanks!

DefamsTV
Автор

my advice do more videos in java plzz
your explanation is very good

shivaprasad
Автор

You deserve 1 Million subs. Keep the good work buddy. I am currently looking to start as an internship java developer and your videos are helping me a lot. Thank you !

bahtipicha