About Question enthuware.ocpjp.ii.v11.2.3373 :
Moderator: admin
-
- Posts: 1
- Joined: Fri May 29, 2020 5:42 pm
- Contact:
About Question enthuware.ocpjp.ii.v11.2.3373 :
first answer @SuppressWarning("rawtypes") marked as correct. But, JDK 11 does not contain this interface. May be it is mistyped and should be @SuppressWarnings("rawtypes")
-
- Site Admin
- Posts: 10058
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3373 :
Yes, it should be SuppressWarnings. Fixed.
thank you for your feedback!
thank you for your feedback!
If you like our products and services, please help us by posting your review here.
-
- Posts: 61
- Joined: Sat Feb 15, 2020 8:56 am
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3373 :
Are @SuppressWarnings("rawtypes") and @SuppressWarnings({"deprecation", "unchecked"}) indeed annotations?
For me it looks rather like they are proper calls to annotation (?), something like that, and annotation is @SuppressWarnings itself.
In the answer, why would stringLists[0].get(0) throw exception? Shouldn't it be array[0].get(0)?
For me it looks rather like they are proper calls to annotation (?), something like that, and annotation is @SuppressWarnings itself.
In the answer, why would stringLists[0].get(0) throw exception? Shouldn't it be array[0].get(0)?
-
- Site Admin
- Posts: 10058
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3373 :
Well, if you want to be that precise then @SuppressWarnings is not an annotation either. SuppressWarnings is. But from the context of the question, I think the meaning is quite clear.
What happened when you tried to compile and run the given code? Did you check the comments given in the code?In the answer, why would stringLists[0].get(0) throw exception? Shouldn't it be array[0].get(0)?
The point is that a List that was supposed to contain Strings now contains an Integer.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 45 guests