CodeGym /Courses /Java Multithreading /Practice cloning

Practice cloning

Java Multithreading
Level 1 , Lesson 8
Available

"Hi, Amigo!"

"I just found a magazine from 2014. Can you imagine?"

"And it has a set of cloning tasks that are older than dirt. Check it out:"

12
Task
Java Multithreading, level 1, lesson 8
Locked
Deep cloning of a map
Deep cloning of a map
12
Task
Java Multithreading, level 1, lesson 8
Locked
Cloning plants
Cloning plants
6
Task
Java Multithreading, level 1, lesson 8
Locked
Prevent cloning
Prevent cloning
Comments (14)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Evgeniia Shabaeva Level 42, Budapest, Hungary
3 December 2024
Wow! I don't believe I have just completed this.
matemate123 Level 50, Kraków, Poland
3 March 2023
Doable tasks!
Ibrahim Level 24, Sheffield, United Kingdom
17 January 2022
Shallow copy vs Deep copy and their differences when cloning https://www.geeksforgeeks.org/clone-method-in-java-2/
Jurij Thmsn Level 29, Flensburg, Germany
16 June 2021
How is nr3 "easy" ? Its the hardest on this page. Anyways. Joshua Bloch says, cloning like this is a bad idea. You should rather use Copy constructors and factories. So its probably not worth spending tooooo much effort on this topic.
Andrei Level 41
24 March 2021
For the "Prevent cloning" task ask yourself - when you're trying to clone C, if you can't use super.clone() from B class (as this will return an error), what source of information can you use for the new clone? And in B class, if you're not supposed to clone this class, what should you return?
Andrei Level 41
24 March 2021
I solved it in about 80 minutes, 41 attempts and many google searches without results because it is a very specific situation so I ended up using the mentor solution. But it was a good exercise, because all of the googling and trying to understand the task made me learn new things and better understand the cloning thingy/situation.
Mike McKenna Level 25, Wilmington, United States
6 March 2021
Hi Luyi, Thank you
Shilpa nori Level 34, Rochester, United States
24 February 2021
Is it just me or is anyone else struggling to understand the logic ? 😌
Deng Xin Level 25, Shanghai, China
25 May 2021
me too, I found it is not easy to deal with even the easy one
Hoist Level 38, San Diego, United States
30 October 2023
Co Pilot helps ; -- and reads me the debug via audio ... of course supplemental info. Codegym is a totally great platform and I have been here for 4 years. My 2nd lap around since I didn't finish .... tenacity for the win )
Luyi Level 31, Kosice, Slovakia
8 October 2019
This link can be helpful: https://www.techiedelight.com/shallow-copy-vs-deep-copy-java/
Thomas Level 41, Bayreuth, Germany
28 May 2020
Thanks
Simphiwe Level 33, Johannesburg, South Africa
12 April 2023
Good material
Hoist Level 38, San Diego, United States
30 October 2023
Thanks for the post !