I do not understand the differences between inheritance, extends and interfaces in JAVA | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I do not understand the differences between inheritance, extends and interfaces in JAVA

18th Aug 2017, 2:21 AM
Javier I. Rivera R.
Javier I. Rivera R. - avatar
4 Answers
+ 1
An interface is an abstract "class" that is used to group related methods with "empty" bodies: To access the interface methods, the interface must be "implemented" (kinda like inherited) by another class with the implements keyword (instead of extends). The body of the interface method is provided by the "implement" class. The implements keyword is used to implement an interface. The interface keyword is used to declare a special type of class that only contains abstract methods.
14th Jul 2020, 12:57 AM
Diego Cariola
Diego Cariola - avatar
- 2
ok just a inheritance is a "gift" to child classes
18th Aug 2017, 2:31 AM
Rodrigo Gabriel Ramos Barros
Rodrigo Gabriel Ramos Barros - avatar
- 2
To extend you borrow from the class, this is the inheritance
18th Aug 2017, 2:33 AM
Rodrigo Gabriel Ramos Barros
Rodrigo Gabriel Ramos Barros - avatar
- 2
The interface is a totally abstract class it is only implemented by other classes
18th Aug 2017, 2:35 AM
Rodrigo Gabriel Ramos Barros
Rodrigo Gabriel Ramos Barros - avatar