• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Possible errata in OCP study book  RSS feed

 
Greenhorn
Posts: 4
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, im studying to get the OCP Java 8 certification.

I'm readinn the book "OCP Oracle Certified Professional Java SE 8 Programmer II Study Guide, by Jeanne Boyarsky and Scott Selikoff"

I have a doubt, in page 59, there is a lambda example, that I think that there is no possible way to assign it to a Functional Interface:




For example, the next lambda expression:



can be successfully asigned to a IntConsumer:



greetings

Jaime Reyes

 
Master Rancher
Posts: 3001
105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Jaime,

welcome to the Ranch and enjoy the stay!

I think you are correct. I could not come up with code that accepted

The 'int' must be replaced by 'Integer'.
The Functional Interface is here a BiFunction, for instance

Replacing Integer by int gives an error.
 
Jaime Rebel Gaiden
Greenhorn
Posts: 4
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I was just focusing on already created Functional Interfaces, but, I found there is a way to make it compile successfully:



an the caller

 
Piet Souris
Master Rancher
Posts: 3001
105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right. Have a cow!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!