• 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

Sybex CSG 17, Chapter 13, page 773 -- possible need for clarification

 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question 4 of the review question asks which lines would need to be changed for the code to compile, but doesn't call out line  w4:



... where result has type Future. Future.get() throws two checked exceptions and the code snippet doesn't show catching or declaring these exceptions. If we assume the snippet is inside a try-block with an appropriate catch, or is part of a method that declares the exceptions, then it would be fine, but without that assumption, there would be a compile error on that line. That could be clarified a bit.
 
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

Greg Charles wrote:... where result has type Future. Future.get() throws two checked exceptions and the code snippet doesn't show catching or declaring these exceptions. If we assume the snippet is inside a try-block with an appropriate catch, or is part of a method that declares the exceptions, then it would be fine, but without that assumption, there would be a compile error on that line. That could be clarified a bit.


That assumption is stated in the intro (that if code is missing you can assume it is correct). It's also true throughout the entire book. So this question works as we intended
reply
    Bookmark Topic Watch Topic
  • New Topic