Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Java OCP 8 Programmer II StudyGuide: page 557 (Chapter 4 mock explanation) #12 errata?

 
Greenhorn
Posts: 3
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Correct answers should be A, F, G, and E. Consumer<String> can be assigned String::new.

Tested with JDK 1.8
 
Marshal
Posts: 79642
380
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch
Please explain more about the question; most of us don't have that book.
 
Mikhail Saltyshev
Greenhorn
Posts: 3
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Welcome to the Ranch
Please explain more about the question; most of us don't have that book.

Screen-Shot-2021-01-10-at-16.42.33.png
[Thumbnail for Screen-Shot-2021-01-10-at-16.42.33.png]
Screen-Shot-2021-01-10-at-16.43.10.png
[Thumbnail for Screen-Shot-2021-01-10-at-16.43.10.png]
 
Campbell Ritchie
Marshal
Posts: 79642
380
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you simply ask which of those lines of code will compile,

Supplier<String> sup = String::new;

...will compile too. There must be more to it than that.
 
Mikhail Saltyshev
Greenhorn
Posts: 3
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:If you simply ask which of those lines of code will compile,

Supplier<String> sup = String::new;

...will compile too. There must be more to it than that.



What do you mean? The question is "Which functional interfaces complete the following code? (Choose all that apply)". The answer should be: A, F, G, as well as E, since Consumer<String> can also complete the first line.
 
author & internet detective
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Added to an errata. Have a cow for being the first to notice after all this time!

Luckily, we did fix this in our Java 11 book.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic