Practice with abstract classes
Comments (8)
- Popular
- New
- Old
You must be signed in to leave a comment
Justin Smith
31 July 2021, 13:58
For a "big task" I was surprised how easy this one was. Nothing you haven't done before in previous easy tasks.
+2
Johannes
21 March 2020, 09:47
It is SOOOOooooo overcomplicated ?
Sorry, I know I am complaining, and still a newbie in Java. But why not simplify it and use methods ?
eat(), move(), etc.
0
Angus McDonaldExpert
8 May 2020, 09:50
Finding this tricky also.. but I suspect because methods (eg. Run) are housed within classes (eg. Dog) and are accessible specifically by the object that's been created using that class (eg. Dog.run). Interfaces create a publicly available "method" (if its easier to refer to them that way) that allow classes of all kinds to use them ("inherit").
Eg. a Cat, a Dog, a Mouse can all access the same "Run" action because its programming sits outside the Cat/Dog/Mouse classes.
I think that's how it works. Could be wrong ha!
+10
Jonaskinny Java Developer at Sandmedia
26 February 2022, 05:58
Porymorphic benefits via interfaces over inheritance
0
Oregano
11 January 2020, 20:57
THAT was a big task? :)
+7
Muhammad Vahhaaj
10 July 2019, 06:06
Alright, from the preceding topics what i conclude about:
Abstraction - is that it is used to create an idea of a system of classes, where we can make fundamental methods that the inheriting class can implement in its own way and we can also define implemented methods that are already common in all the derived classes
Interfaces - is much like abstraction but is used to define roles/methods that specific classes can implement in their own style and it is through these roles, using the mechanism of abstraction and polymorphism, we interact with objects of other classes.
+17
Devonte A
1 July 2020, 09:45
Yes you got it!
+1
Muhammad Vahhaaj
10 July 2019, 06:02
Hmm, not so big
+2