CodeGym /Courses /Java Core /Bonus task | Lesson 8 | Level 4

Bonus task | Lesson 8 | Level 4

Java Core
Level 4 , Lesson 8
Available

"Hey, soldier!"

"Good day, Captain!"

"I've got awesome news for you. Here are some exercises to reinforce your skills. Do them every day and your skills will grow at an insane speed. They were created especially for IntelliJ IDEA."

8
Task
Java Core, level 4, lesson 8
Locked
Bridges
Bridges
8
Task
Java Core, level 4, lesson 8
Locked
Wine tasting
Wine tasting
16
Task
Java Core, level 4, lesson 8
Locked
User, loser, coder and programmer
User, loser, coder and programmer
4
Task
Java Core, level 4, lesson 8
Locked
Implement the printMainInfo method
Implement the printMainInfo method
8
Task
Java Core, level 4, lesson 8
Locked
Computer
Computer
16
Task
Java Core, level 4, lesson 8
Locked
MovieFactory
MovieFactory
8
Task
Java Core, level 4, lesson 8
Locked
Janitorial services
Janitorial services
8
Task
Java Core, level 4, lesson 8
Locked
Fixing bugs
Fixing bugs
16
Task
Java Core, level 4, lesson 8
Locked
Currencies
Currencies
8
Task
Java Core, level 4, lesson 8
Locked
Fix four mistakes
Fix four mistakes

"Those previous exercises were for rookies. I've added some more advanced bonus exercises for the old-timers. Just for veterans."

8
Task
Java Core, level 4, lesson 8
Locked
Exception invasion
Exception invasion
16
Task
Java Core, level 4, lesson 8
Locked
GCD
GCD
8
Task
Java Core, level 4, lesson 8
Locked
Singleton
Singleton
Comments (51)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Dom Level 21, England, United Kingdom
25 October 2025
GCD was confusing as hell the instructions made no sense for me
Simphiwe Level 33, Johannesburg, South Africa
14 March 2023
Hey, does anybody know how to solve this test case "For each string entered (including the invalid string), you must call the MovieFactory.getMovie method." in the MovieFactory task.
Anonymous #10782038 Level 24, United States of America
10 April 2024
That one took me a while. basically in your while loop you check that the input in general is not null, then you assign the movie var using getMovie and then check if movie == null which means it was not one of the valid keys.
Rene Level 1, Netherlands
15 May 2024
I did no checks on the received input as the getMovie method will return null if the input is invalid (not matching one of the defined values). I call getMovie on every input and exit the loop if getMovie gives me a null value . In the loop you can proceed to print what is needed as at that point you will have received a valid object from getMovie.
Anonymous #10772722 Level 15, Clayton
14 January 2022
"Create a singleton!" they said despite never discussing how to implement one or what a singleton is. Seeing no comments of people wondering how the heck we were supposed to solve this makes me wonder if comments are being deleted. I'm not sure what the value is in having to search the web to understand something we're paying to learn.
Anonymous #10782038 Level 24, United States of America
1 April 2024
pretty common with this site. honestly I am just using this site for the excercises and learn the topic elsewhere.
Justin Smith Level 41, Greenfield, USA, United States
6 August 2021
Wow, 13 tasks on this page! Going to do all of them.
TheLordJackMC Level 39, Princeton, idk somewhere
15 July 2021
did he get demoted?
Naughtless Level 41, Olympus Mons, Mars
10 July 2021
The GCD task is buggy as hell. It wants you do do the GCD algorithm exactly like the reference solution. I implemented a GCD algorithm I got from some other website, and just used a simple if statement to check whether the numbers were negative (which is exactly what the reference did) and threw an exception if so. The verifier literally will not accept the algorithm, even if it did exactly the same thing when I tested 5 different scenarios on the code and returned the correct answers (and threw exceptions when the numbers were negative).
whoseunassailable Level 28, India, India
6 March 2022
i put my own solution instead and in my own manner and was able to properly execute the code . Took 2 attempts to pass the test but it worked like a charm.
DarthGizka Level 24, Wittenberg, Germany
4 June 2021
task1421 (Singleton) caveat: the static Singleton instance field must be named instance. This requirement is easy to overlook.
Anonymous #10853261 Level 1, Queens: git commit -m 'get the money', United States
22 December 2021
I found this a little frustrating - more applicable feedback from codegym would have been peachy... Is the naming of the Single instance 'instance' inherent, as in a best practice that I should have already known?
Олег Байбула Level 32, Ukraine Expert
11 January 2023
I've got "Check your code. It looks like you have an infinite loop." exeption. Despite it works perfectly in the IntelliJ.
DarthGizka Level 24, Wittenberg, Germany
4 June 2021
task1416 (Fixing bugs) caveat: the test whether Whale and Orca are derived from SeaCreature and implement CanSwim is broken. I derived both from an intermediate class SeaCreatureThatCanSwim which inherits SeaCreature and implements CanSwim, but the test for the requirements regarding derivation from SeaCreature and implementation of CanSwim *failed*. So you better be good and imitate a sloppy, inept programmer in order to get your code to pass...
Jokeres Level 24, Budapest, Hungary
31 March 2021
Computer task was rly good. I love learning keycombinations to shorten things
Shilpa nori Level 34, Rochester, United States
27 January 2021
For gcd task , you just have to throw exception. It took me a while to get that alone right.