+ 1

what is the diffetence when we say an interface extends another interface and a class implements an interface?

19th Nov 2019, 7:13 PM
Abdul Wahab
Abdul Wahab - avatar
11 Réponses
+ 1
Abdul Wahab If you use the keyword abstract for the child class declaration then you cannot call it a concrete(non-abstract) class. Also remember that an abstract class need not have an abstract method, it can also have only non-abstract methods but if you declare a method abstract inside the class then your class should be declared abstract.
20th Nov 2019, 10:19 AM
Avinesh
Avinesh - avatar
+ 5
A class can also extend another class.
21st Nov 2019, 3:11 AM
Sonic
Sonic - avatar
+ 4
extending an interface means you are inheriting from an interface to extend its functionalities... a class implementing an interface means a class has to do whatever that interfaces dictates. unless the class is declared as abstract.
19th Nov 2019, 9:52 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 4
An interface provides just the methods. It can extends an interface. For example you have an interface animal and an interface bird: interface Bird extends Animal This makes sense because all Birds are Animals. But without implementing the interface Bird both interfaces would make no sense. Because an interface can't create objects. It just used for the behavior of a class. public class Hawk implents Bird Here you implement all methods of Animal and all methods of Bird. In short: Interfaces describes what classes should do, without specifying how they should do it.
19th Nov 2019, 11:09 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
Always remember that interface contains abstract methods(not including default and static for simplification). So when we say an interface extends another interface then the extending interface need not give implementation for the inherited methods. Whereas when we say a class implements an interface and if it is a concrete class(non-abstract) then it should give implementation for all the methods it has inherited from the interface.
20th Nov 2019, 1:11 AM
Avinesh
Avinesh - avatar
+ 2
Avinesh thnks for your time. It helpd me allot
20th Nov 2019, 10:28 AM
Abdul Wahab
Abdul Wahab - avatar
+ 2
It's good to know Abdul Wahab and you're welcome.
20th Nov 2019, 10:34 AM
Avinesh
Avinesh - avatar
+ 1
if a class provides all the function bodies of an interface, then it would be concrete and then it would not be considered as abstract. Is it correct? bahha Denise Roßberg Avinesh
20th Nov 2019, 3:40 AM
Abdul Wahab
Abdul Wahab - avatar
20th Nov 2019, 3:45 AM
Avinesh
Avinesh - avatar
0
and is it true to say that an abstract child class that implements an interface becomes concrete only if it provides all the function bodies of its parent abstract class and function bodies of interface that it implements?
20th Nov 2019, 10:05 AM
Abdul Wahab
Abdul Wahab - avatar
20th Nov 2019, 10:05 AM
Abdul Wahab
Abdul Wahab - avatar