Hi - Re the explanation for why the fourth option does not compile:
"Since the variable names is of type List<String>, its addAll method can only accept objects whose declared type is a String. Declared type of oa[0] and oa[1] is Object and therefore it will not compile. The compiler doesn't know that these elements actually hold Strings"
I think this is a bit off in that the method need a List<String>, not just individual Strings, so even if the elements passed here were typed to String it still would not compile.
About Question enthuware.ocpjp.v8.3.1922 :
Moderators: Site Manager, fjwalraven
-
- Posts: 25
- Joined: Thu Jun 01, 2017 2:50 pm
- Contact:
-
- Site Admin
- Posts: 10386
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.3.1922 :
You are right. The explanation is off. Fixed.
thank you for your feedback!
thank you for your feedback!
-
- Posts: 25
- Joined: Thu Jun 01, 2017 2:50 pm
- Contact:
Who is online
Users browsing this forum: Bing [Bot] and 5 guests