• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Clarification in page 340,341 of the OCP Java SE 8 Programmer II Study Guide (Sybex)

 
Ranch Hand
Posts: 182
18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I saw in Javadocs that Future is a interface

But in the Sybex guide Page 340 3rd para last line, it says "when discussing the Future class", ...then class must be interface

I saw this again in Page 340 under Waiting for Results , in the para line it says "Future class includes methods".

and similarly in page 341 in the second paragraph after the code it says "As Future<V> is a generic class".

 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll admit it, that ones mine! Since you never have to work with the specific implementation class of Future when studying concurrency for the OCP 8 exam, I got used to thinking of it as a class.

I love the factory pattern (where the specific return class type is "hidden" in favor of coding to an interface) but it has the side effect of you tend to think of an instances of an interface as belonging to a class with the same name.

Same thing happens when working with NIO.2, Path is an interface but it often is used like a class, since you are unlikely to ever work with the file system dependant class type. We did fix similar errors for Path, must have missed some for Future in Chapter 7!

If you call get() on a Future instance of our book, it shall be fixed
 
Ramya R Subramanian
Ranch Hand
Posts: 182
18
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Scott Selikoff wrote:If you call get() on a Future instance of our book, it shall be fixed


Sure. No problem
 
author & internet detective
Posts: 41860
908
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
Noted in the errata. Thanks.
 
I'm all tasted up for a BLT! This tiny ad wants a monte cristo!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic