• Post Reply Bookmark Topic Watch Topic
  • New Topic

OCP Java 8 SE Study Guide - Chapter 7- Concurrency (Sybex)  RSS feed

 
Ranch Hand
Posts: 46
1
Java Oracle
  • X Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

There is one typo in AmbiguousLambdaSample class example. The main method should throws IOException exception.

Thanks
 
author & internet detective
Sheriff
Posts: 37839
586
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good find. Thanks for noticing. I've added it to the errata list. It's on page 343 of the print book as a reference to non Safari readers.
 
Greenhorn
Posts: 2
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne, hi Prateek,

I don't think "throws IOException" is necessary here, as none of the methods (useCallable, useSupplier and use) declare to throw an IOException. An IOException is thrown from the lambdas, but that doesn't matter.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37839
586
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Philippe,
It's hard to say because there are two lines that are flagged as not compiling. So what would be needed if it were to compile is subject to debate. Which means in this case, if adding the exception makes it clearer, I'm fine with it. (I agree it isn't actually needed).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!