Page 1 of 1

About Question enthuware.ocpjp.v11.2.3380 :

Posted: Sun Jan 23, 2022 2:55 pm
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.

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

Posted: Sun Jan 23, 2022 10:47 pm
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!