Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Sybex 816 Chapter 7 Page 1013 Kindle Edition

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 7 Page 1013 Q3 Answer: Option A is wrong.
All methods are capable of throwing unchecked exception is wrong because, call() can throw, but run() can't.

Please correct it.

Question is at Chapter 7 Page 635
 
Ranch Hand
Posts: 30
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if we have an implementation of MyRunnable like below?

it will throw the unchecked exception (NullPointerException).
Moreover, since it is an unchecked exception, there is not restriction to declare it with the throws keyword
 
Sriram Muthaiah
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Tomasz Kasprzyk Thanks for your response. I agree, My bad, I didn't realize that question is about an unchecked exception.
 
Marshal
Posts: 70684
288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
It shows how important it is to read the questions carefully. The code TK showed you will compile, which is what matters for an exam question. It might be poor design, but the question isn't asking whether the code is well designed or not.
 
You have to be odd to be #1 - Seuss. An odd little ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic