+ 1

If overriding a method is the same as making a new one, why use overriding in the first place?

6th Nov 2016, 7:11 PM
Jack Chase
Jack Chase - avatar
2 Answers
+ 2
all the benefits of developing is to be able to use code several times without rewriting it. moreover sometimes the initial method is in a library and you don't have the source code. so you can just override it.
6th Nov 2016, 7:31 PM
Steve DICAY
Steve DICAY - avatar
+ 2
Yes, it is all about encapsulation and code reusability. I can change the way pre-written code and classes are going to operate by overriding a method in a parent class. Sometimes we override things built into Java as well like creating our own toString() methods etc...
10th Nov 2016, 9:59 PM
Sean Corcoran