Page 1 of 1

About Question enthuware.ocpjp.v7.2.1206 :

Posted: Wed Sep 27, 2017 4:37 am
by horst1a
Shouldn't class FileCopier implement AutoCloseAble here ?

Re: About Question enthuware.ocpjp.v7.2.1206 :

Posted: Wed Sep 27, 2017 9:22 am
by admin
Why do you think so?

Re: About Question enthuware.ocpjp.v7.2.1206 :

Posted: Thu Sep 28, 2017 4:39 am
by horst1a
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

Re: About Question enthuware.ocpjp.v7.2.1206 :

Posted: Thu Sep 28, 2017 8:57 am
by admin
It is the resource that is being opened in the try block that should implement AutoCloseable. FileCopier class is not that resource.

Re: About Question enthuware.ocpjp.v7.2.1206 :

Posted: Thu Sep 28, 2017 9:24 am
by horst1a
Oh, thank you, thats a good explication