What Could be the example scenarios to declare any class or any method as “final”? When do we need to do this?
Please give me some example to understand the practical use of “final”…
please elaborate your answer….
please guide me as I am a beginner in OOP
This is just an example to elaborate why methods/classes must be locked down sometimes from any further extensions to avoid surprises.
This is just an example to illustrate why it’s necessary to make methods and classes final. In fact, it is a very good practice to make all your methods and classes final unless you know you are going to extend them, and the subclasses may want (and will be allowed) to extend/override the base class.