Hello
I'm a new programmer in JAVA. And i need to understand the "interfaces" with (real examples).
Let me to explain it:
This is an abstract class for polymorphism for the Animals (Dogs, Cats etc...):
This is an interface just for them (Tame) Animals.
I need to implements the Tame interface to the "Dog". As you know dog is a tame animal.
I have another class is for the Lion. Lion is not a Lame.
My problem is:
I can't access to the "Dog" (interface) via the polymorphism with this code:
IS NOT WORKING!!
But i can't access to it via the interface:
* Why i can't access to the "play" method via Animal?
* We know the interface is 100% abstract. If so why i can create a conrete class of it?
Thanks a lot
I'm a new programmer in JAVA. And i need to understand the "interfaces" with (real examples).
Let me to explain it:
This is an abstract class for polymorphism for the Animals (Dogs, Cats etc...):
This is an interface just for them (Tame) Animals.
I need to implements the Tame interface to the "Dog". As you know dog is a tame animal.
I have another class is for the Lion. Lion is not a Lame.
My problem is:
I can't access to the "Dog" (interface) via the polymorphism with this code:
IS NOT WORKING!!
But i can't access to it via the interface:
* Why i can't access to the "play" method via Animal?
* We know the interface is 100% abstract. If so why i can create a conrete class of it?
Thanks a lot