About Question enthuware.ocpjp.v11.2.3380 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
brintal
Posts: 6
Joined: Sun Jan 23, 2022 8:43 am
Contact:

About Question enthuware.ocpjp.v11.2.3380 :

Post by brintal »

I think the first answer choice should be removed from this question:
Apply @SuppressWarnings("all") at //1
Contrary to the explanation, "all" works very well to remove the warnings in this case. I checked this with the following jdks:
jdk-11.0.14 (oracle)
zulu-11-amd64
adoptopenjdk-11-hotspot-amd64

If the question means to ask what is the better way (as we all know just turning off all compiler warnings is not a good idea), it should say so. But as the question is now, @SuppressWarnings("all") on class level would be a perfectly fine answer as it removes all compiler warnings.

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

Re: About Question enthuware.ocpjp.v11.2.3380 :

Post by admin »

It is true that a compiler may allow many values (including "all"). However, as far as the exam is concerned, it is better to go with the values that the specification mentions in section 9.6.4.5 @SuppressWarnings, specially when you have to select only 1 option. That is why in our opinion, the best option in this case is "unchecked".

I have updated the explanation to make this point clear.
thank you for your feedback!

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests