• Post Reply Bookmark Topic Watch Topic
  • New Topic

OCP Study Guide Review Question question  RSS feed

 
Elana Abelev
Ranch Hand
Posts: 30
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

  I don't understand the explanation to Chapter 7 Review Question 10 for option C.  The explanation states that "c1 is a String but c2 is an int"...  Why is that? 

The reduce method signature is:

 

In the question, the method call is:

 

So, in the question the type of the first parameter to reduce (the identity element) is int.  Shouldn't then the first argument to the BiFunction be an int as well?   That would make c1 the int and c2 the String... 

Please, clarify!!
Thank you very much!
 
Scott Selikoff
author
Bartender
Posts: 4085
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is correct, it is C.

The c1/c2 are reversed in the explanation.  This one is already listed on our errata page:  https://www.selikoff.net/ocp

"10: The answer is correct. In the explanation, c1 should be an int and c2 should be a String rather than vice versa."

Sorry about that!
 
Elana Abelev
Ranch Hand
Posts: 30
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, I didn't see it in the errata because I didn't scroll far enough and didn't realize that chapter numbers begin again further down the page.  See it now.  Thank you.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!