About Question enthuware.ocpjp.v7.2.1206 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
horst1a
Posts: 37
Joined: Mon Jun 12, 2017 2:16 am
Contact:

About Question enthuware.ocpjp.v7.2.1206 :

Post by horst1a »

Shouldn't class FileCopier implement AutoCloseAble here ?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Why do you think so?

horst1a
Posts: 37
Joined: Mon Jun 12, 2017 2:16 am
Contact:

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

Post 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

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

It is the resource that is being opened in the try block that should implement AutoCloseable. FileCopier class is not that resource.

horst1a
Posts: 37
Joined: Mon Jun 12, 2017 2:16 am
Contact:

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

Post by horst1a »

Oh, thank you, thats a good explication

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests