CodeGym /Courses /Java Multithreading /Practice inheriting nested classes

Practice inheriting nested classes

Java Multithreading
Level 4 , Lesson 4
Available

"Hi, Amigo!"

"Here's a spiffy set of tasks for you. I hope you like them:"

13
Task
Java Multithreading, level 4, lesson 4
Locked
Refactoring Rectangle
Refactoring Rectangle
26
Task
Java Multithreading, level 4, lesson 4
Locked
Black box
Black box
7
Task
Java Multithreading, level 4, lesson 4
Locked
Inheriting an inner class
Inheriting an inner class
Comments (7)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Hoist Level 17, San Diego, United States
12 August 2025
Output 5 4 3 2 1 FirstClass class, someAction method SecondClass class, someAction method Specific action for anonymous SecondClass, param = 0 The number of created Action objects is 2 SecondClass class, someAction method Specific action for anonymous SecondClass, param = -1 The number of created Action objects is 3
Jurij Thmsn Level 29, Flensburg, Germany
22 October 2021
Don't dig too deep into BlackBox, it's not worth it. There is so much else important to learn about java which is much more worth the time.
null Level 26, Orlando, United States
11 August 2020
BlackBox task is confusing. Need better explanation
Fadi Alsaidi Level 34, Carrollton, TX, USA
16 December 2020
It really was. I suggest debugging to follow along. Essentially the code makes the Solution's "someAction" go throw an if logic based on "param" number. The if logic either return a firstClass's "someAction" or return a Solution's "smartAction". since the parm starts with a 5, the if logic keeps returning the solutions calss"smartAction" which basically re-excute the same if logic ...so kinda like a loop where the firstclass method keeps calling back it's super calss's method "Solution" someActione until the "param" is less than 0...This loop I am talking about all happens in the "getDependantAction method which returns an Action Object. The action object either is the Solution's calss or the first class. .but really watching the debug go through it might help more espically around the "This" keyword which is kinda confusing with outer and inner classes
Henrique Level 41, São Paulo, Brazil
29 July 2020
My impression is that a lot of these tasks are deliberately confusing. On the first one, e.g., if we follow exactly the steps that Kim gave us on the last lesson, the code won't work (it won't even compile). So we'll have to search for the solution somewhere else, which makes the task not "easy" at all. There's a lack of explanation and exemples. Fortunately we have some people on the help session that already passed such tasks, so we can copy and paste their codes, hoping that one day we will find explanations and will understand the solutions.
Isma Level 1, Madrid, Spain
29 January 2021
Did that day come?
LaikaLaikaka Level 32, United States of America, United States
7 May 2025
No