CodeGym /Courses /Java Multithreading /Practice using local classes

Practice using local classes

Java Multithreading
Level 4 , Lesson 6
Available

"Hi, Amigo!"

"Here are a few more tasks. I hope you enjoy them."

13
Task
Java Multithreading, level 4, lesson 6
Locked
Implementing an interface using a local class
In the Cat class, implement the toCanSpeak method's logic, which is described in a Javadoc.
13
Task
Java Multithreading, level 4, lesson 6
Locked
How to avoid Copy+Paste
In the Dog class, implement the toCanSpeak method's logic, which is described in a Javadoc.
26
Task
Java Multithreading, level 4, lesson 6
Locked
Online store for jeans
1. Create 2 interfaces in separate files: 1.1) Item with int getId(), double getPrice(), and String getTM() methods 1.2) Jeans extends Item with the int getLength() and int getSize() methods. 2. In the Util class, add the missing Java code to the getAllJeans method.
Comments (17)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Evgeniia Shabaeva Level 40, Budapest, Hungary
6 February 2025
Thank you for the tasks, they taught me a lot!
Paweł Mackiewicz Level 32, Poland, Poland
20 January 2025
I love the "I got it!" feeling when I finally understand what a task is about and how to solve it :)
Dan Level 26, Clarksville, United States Expert
15 December 2021
These 3 tasks were a lot easier than some of the previous ones. I'd like to think I'm getting smarter, but I think these just clicked a little easier. KEEP PUSHING CODEGYM FRIENDS!! WE'RE GONNA MAKE IT!
Jurij Thmsn Level 29, Flensburg, Germany
25 October 2021
the hard one was the easiest this time 😳
Jurij Thmsn Level 29, Flensburg, Germany
25 October 2021
About "How to avoid Copy+Paste " : I think the commented "// Add some logic here" in the SuperDog class is misleading. It implies that you have to change something in this method which isn't the case.
Andrei Level 41
9 April 2021
What is with the date / calendar whole deal? I really dislike them!😩
Jurij Thmsn Level 29, Flensburg, Germany
25 October 2021
me too 🙄 everytime I have to use it, I have to look it all up again. Still can't get used to it
Andrei Level 41
27 October 2021
Bro, don't even bother, I don't think it's even used today in the enterprise environment.
Jurij Thmsn Level 29, Flensburg, Germany
28 October 2021
You'e absolutely right. I'll rather have a look at calendar class.
Andrei Level 41
9 April 2021
The first one was fun!
MaGaby2280 Level 41, Guatemala City, Guatemala
4 August 2020
Tricky ones... always mind the spaces in Stringbuilders!!!
BlueJavaBanana Level 37
3 August 2020
Tip for how to Avoid Copy-Paste The example output asks for this (note the lack of a space at the first ***: *** Barbossa *** says ruuuuuff! Wed, 13-Nov-2013 What you have to do is include the silly space at the start of the first " *** " like this... *** Barbossa *** says ruuuuuff! Wed, 13-Nov-2013 Very, very annoying to waste time on such trivial matters!
klesk Level 31, Duisburg, Germany
31 August 2020
When you use getSuperQuotes() from SuperDog Class you shouldn't have this problem.
BlueJavaBanana Level 37
31 August 2020
Thanks for the tip!
Michał Level 41, Krakow, Poland
8 October 2020
Well, I've used getSuperQuotes() but those stupid spaces got me anyway. Notice that there are two spaces between "***" and "says" or "is sleeping." Really annoying. Though thanks to your tips at least I knew where to look for the mistakes. Cheers!
Jurij Thmsn Level 29, Flensburg, Germany
25 October 2021
thanks! I did the same
Henrique Level 41, São Paulo, Brazil
30 July 2020
Hint for "Online store for jeans": The format of the price ("150.0") is not verified in the task. I lost a lot of time trying to convert my result ("150,000000") to 150.0 and turns out it's not necessary for validation. This was my output and task was completed:

Levis{id=1, length=34, size=6, price=150,000000}
Armani{id=2, length=35, size=8, price=154,000000}
{id=0, length=0, size=0, price=0,000000}
{id=0, length=0, size=0, price=0,000000}