Question : - for Extends
Post a Reply
|Oldest Newest Rating|
· October 12, 2016
Extends is for sub-classing an Class and implements is for using an interface. ( a Class can only extend one class)
If the interface requires you to override a method then you have to override the method. Usually because the method in the interface is just a template to provide a behavior and doesn't do anything.
· October 13, 2016
The reason you have to copy all of the methods of an interface when you implement it is because they are abstract. This provides some benefits. You can group objects of different classes by an interface and call all of the classes methods that are in the interface.
If you were capable of extending the interfaces, you'd still have to copy the methods. Like I said previously, interfaces are abstract, and when you extend or implement something abstract, you have to define all of their abstract methods.
Java / Android Development
Very popular language used to create desktop applications, website applets, and Android apps.
|Bucky Roberts Administrator|