Isn't making properties 'static' similar to making methods 'final'? If I'm not wrong static properties are immutable right? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Isn't making properties 'static' similar to making methods 'final'? If I'm not wrong static properties are immutable right?

24th Dec 2020, 4:28 PM
Unaish Ahmed
Unaish Ahmed - avatar
1 Answer
+ 1
Static members belong to the class and they are shared to their subsequent child classes as well. But when you declare the same identifier in your child class, you hide the one which is with the parent. Final keyword makes a member immutable, so you cannot override a final method.
24th Dec 2020, 5:58 PM
Avinesh
Avinesh - avatar