Hi,
The explanation of the 2nd option "Device should implement Closeable and override close() method." is reasonable. Basically is a matter of how the response or question is using "should" and not "may".
But, there is no explanation on why the "Device should implement AutoCloseable..."
Is it because is more generic than Closeable?
Because its close method is not required to be idempotent?
Would you please clarify?
About Question enthuware.ocpjp.v11.2.3359 :
Moderator: admin
-
- Posts: 8
- Joined: Sat Jan 20, 2018 1:36 pm
- Contact:
-
- Site Admin
- Posts: 10383
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3359 :
It should implement AutoCloseable because that i the minimum that is required for a Device to be used in a try-with-resources statement. Without implementing AutoCloseable the given code will not compile.
Closeable is not required.
Closeable is not required.
Who is online
Users browsing this forum: Bing [Bot] and 13 guests