CodeGym /Java Course /Java Multithreading /Practice releasing busy resources

Practice releasing busy resources

Java Multithreading
Level 1 , Lesson 10
Available

"Hi, Amigo!"

"I thought you had already figured out finalize."

"That's what I thought. But now we have this try-with-resources statement."

"Crap. I'm never going to finish learning Java at this rate. I think I understand everything, and then you show up!"

"Don't fret like that—you'll rupture an oil line. Instead, figure out these tasks:"

6
Task
Java Multithreading, level 1, lesson 10
Locked
Refactoring methods
Refactor the writeZipEntriesToFile method to use the Java 7 try-with-resources construct. The program should not have commented code.
12
Task
Java Multithreading, level 1, lesson 10
Locked
Release resources
Implement the finalize method after first thinking about what exactly it should contain. Refactor the getUsers method to use the Java 7 try-with-resources construct.
6
Task
Java Multithreading, level 1, lesson 10
Locked
AutoCloseable and try-with-resources
In the FakeConnection class, implement the AutoCloseable interface so that FakeConnection objects can be used in try-with-resources blocks. The close() method should display the phrase "Closing database connection..." In the try block, call the usefulOperation() method and then the unsupportedOpera
Comments (5)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
24 July 2021
So hard.
31 March 2021

"Crap. I'm never going to finish learning Java at this rate. 
I think I understand everything, and then you show up!"
Thanks for understanding us! 😀
Ruslan Skaldin Level 33, Tashkent, Uzbekistan
18 December 2020
I liked using AutoCloseable interface, very convenient
MaGaby2280 Level 41, Guatemala City, Guatemala
9 June 2020
Glad to move on...
Ewerton Level 30, Belo Horizonte, Brasil
10 July 2019
I hope I really understood it...