About Question enthuware.ocpjp.v7.2.1206 :
Moderator: admin
-
- Posts: 37
- Joined: Mon Jun 12, 2017 2:16 am
- Contact:
About Question enthuware.ocpjp.v7.2.1206 :
Shouldn't class FileCopier implement AutoCloseAble here ?
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1206 :
Why do you think so?
-
- Posts: 37
- Joined: Mon Jun 12, 2017 2:16 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1206 :
Resources are opened in a try with resources block.if that fails or even one of the reosurces cant be opened, they should be closed.
Therefore the class has to implement AutoCloseAble
Therefore the class has to implement AutoCloseAble
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1206 :
It is the resource that is being opened in the try block that should implement AutoCloseable. FileCopier class is not that resource.
-
- Posts: 37
- Joined: Mon Jun 12, 2017 2:16 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1206 :
Oh, thank you, thats a good explication
Who is online
Users browsing this forum: No registered users and 23 guests