+ 3

which of these keywords can be to prevent the method from overidding ? 1.static 2.final 3.protected 4.constant

why the answer is final , although static is also true . am i right ?

16th May 2022, 4:01 AM
Aly Alsayed
Aly Alsayed - avatar
2 odpowiedzi
+ 6
You're right, you can't overriding a static method. but that is not the purpose of a static method but a consequence. The principale way to prevent the method from overriding is the final keyword. https://www.geeksforgeeks.org/can-we-overload-or-override-static-methods-in-java/
16th May 2022, 6:31 AM
Roland
Roland - avatar
+ 4
Google says final...
16th May 2022, 6:22 AM
Mihir Lalwani
Mihir Lalwani - avatar