About Question enthuware.ocpjp.v11.2.3380 :

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

Moderator: admin

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: 10054
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!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests