• Post Reply Bookmark Topic Watch Topic
  • New Topic

CharAt can't be used as ReferenceMethod ??  RSS feed

 
Max Ma
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is practice question from the Test Bank?

Q. 40 Why can’t String::charAt be used as a method reference?

The correct answer is : Method references can pass either the instance of the parameter from the lambda but not both.

However, I can use the String::charAt to implement a BiFunction as below?



Can anyone help to verify the answer?
Screen-Shot-2017-07-17-at-22.45.48.png
[Thumbnail for Screen-Shot-2017-07-17-at-22.45.48.png]
 
Donald Colvin
Greenhorn
Posts: 11
1
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agreed it is an error, already in the errata -- see this post.
 
Max Ma
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Donald Colvin wrote:Agreed it is an error, already in the errata -- see this post.


Thanks Donald.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!