0
What is the purpose of making a class final as we can't further inherit it then why do we make a class final?
What is the need of making a class final?
1 Resposta
+ 1
For example you're making a library for lets say graphic.
And put the graphic as a class, you have a lot of equation inside so it able to display properly.
But what if there's someone who using your lib inherit the class and override one of those method ? There's a chance that it'll broke the algorithm when he use his class.
By using final everyone cant copy and alter those methods