CodeGym /Java Course /Java Core /Practice with abstract classes | Level 3

Practice with abstract classes | Level 3

Java Core
Level 3 , Lesson 4
Available

"Hello, Amigo! I was going to help you with your tasks today. But I'm too tired. And I still have a lot to do this evening: have a beer and play poker with my friends. So, good luck, buddy! Tackle these tasks."

3
Task
Java Core, level 3, lesson 4
Locked
Let's hire a translator
In this task, we'll create a descendant of a generic translator (Translator), who will be a Russian language expert (RussianTranslator). But she won't translate anything in this task. She'll simply state which foreign language she works with.
3
Task
Java Core, level 3, lesson 4
Locked
Code doesn't fix itself
Such a small program shouldn't have had any room for bugs... but alas, this isn't the case! Real programmers can squeeze bugs into any amount of code! But more importantly, the best developers can remove bugs with skill. Fix the code so that the program runs and displays: "I translate from Russian".
3
Task
Java Core, level 3, lesson 4
Locked
A fox is an animal
Do you have any doubt that a fox (unless we are talking about a foxy lady) is an animal, and will remain so for life? If not, then the Animal interface would be perfect for this class. So let's implement it by making a couple of edits to the class itself.
3
Task
Java Core, level 3, lesson 4
Locked
A big fox is still a fox
A big fox is a specific type of fox, while a "ordinary" fox is an animal. Here is a brief outline of what you are going to do in this task. Create an Animal interface, a Fox class (with getName as the only implemented method), and a child of the Fox class (BigFox).
Comments (19)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
TheLordJackMC Level 39, Princeton, idk somewhere
15 July 2021
diego being a bachelor: haha id help but i need to do nothing amigo trying to get a job: help
ImDevin Level 15, Old Town, United States
31 May 2021
just leaving my "footprint" to say "hey, there are peeps who are still working through these things." (last comment was from June 2020 :) These tasks are not too hard, but re-enforcing important concepts. kinda makes me wonder when CG is going to crank things up hard again! Happy coding! :)
Mayu Level 25, Toronto, Canada
16 June 2020
I'm managing to work through all these abstract and interface problems, but I have no idea how it works. Can anybody suggest good reference (books, articles) to understand this?
Joshua Level 19, DALLAS, Republic of texas
16 June 2020
http://www.dblab.ntua.gr/~gtsat/collection/Java%20books/Bruce.Eckel.Thinking.In.Java.4th.Edition.Dec.2007.eBook-BBL.pdf This book was written in 2006, so it only covers up to java 1.5/6. Bruce Eckel does a good job of ensuring every reader is able to understand the concepts. I have about 10 different core Java books and this one is my go to for when I am confused about a topic. The link above is to a pdf of the book. I would recommend purchasing the book so you can sit down and read when your not at your computer and using the pdf as a reference.(After all learning to programming is like learning a foreign language, immerse yourself in the language every chance you get!)
Mayu Level 25, Toronto, Canada
16 June 2020
Thank you Joshua, exactly what I needed.
Andrei Level 41
26 November 2020
I'm in the same situation, but here's my thinking: maybe the information is too new, and we know it, it just hasn't settled in yet. So maybe that is why we can work through the exercises but do no know how it works?
Thomas Sixberry Level 16, Rochester Hills, United States
9 February 2020
These last 3 Levels are so easy they have made me feel as if I am pro. =)
jamylam Level 26, Nairobi, Kenya
7 January 2020
I noted and learnt something very interesting in the last example. We want to use the getName method. But its in the abstract class Fox, which cannot be instantiated. Instead we created a BigFoxclass that inherits properties of the FoxClass. In main, we declared a Fox object but instantiate it with the child class BigFoxClass, so that we can use it to access the get name method which it inherits from its abstract parent class
Felix Level 19
8 November 2019
I don't really get how the Fox class can implement the Anmial interface without implementing the getColor method.
Ivan Level 22, Nope, Bulgaria
2 December 2019
The BigFox inherits Fox and Fox implements Animal getColor() (note, it reaches to the interface, but does not implement its method!). So, Fox doesn't implement Animal's getColor() directly, but in this case, BigFox does it. So the Fox remains abstract while having Animal's getColor() unimplemented and leaving for down the road to a next class to implement it :) The getColor() method is implemented by BigFox.
Isaiah Burkes Level 16, Tampa, United States
23 December 2019
I'm assuming that abstract classes don't need to implement methods of the interfaces that they inherit.
Alexandru Ovcinicov Level 15, London, United Kingdom
26 September 2019
Nice Time solving !
Fa Yu Level 16, Tashkent, Uzbekistan
28 June 2019
all easily done thanks to intellij, but still couldn't understand where and for what reason to use the static for class creation
Muhammad Vahhaaj Level 19, Rawalpindi, Pakistan
10 July 2019
static keyword is used to declare a variable, method or class "shared" it means all the objects have only one copy of that thing. static class is used inside the other class to separate it from that class so that the it does not belong to the objects of the class containing the static class.
Bert Doe Level 22, Flanders, Belgium
25 April 2019
lets keep going
JeRiF94 Level 22, Baku, Azerbaijan
18 April 2019
DONE