Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

chapter 6 reveiw question #14

 
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


A and D are understandable logically.But C and E do not make any sense. What is the logic.JLS says they have to be subclasses of Exception that is mentioned in throws clause. C and E are not subclasses of IOException.Then how are they right answers?What is the logic behind this.Can some one please explain?

FYI: Below is from JLS

 
Marshal
Posts: 3155
466
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RuntimeException and its subclass IllegalArgumentException are unchecked exceptions, and methods are not required to declare that they throw unchecked exceptions.

Section 11.2 of the Java SE 8 JLS says: The unchecked exception classes (ยง11.1.1) are exempted from compile-time checking.
 
Marshal
Posts: 69894
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please always tell us where such quotes come from. Chapter 6 isn't sufficient information for us to find the source.
IllegalArrgumentException and RuntimeException (not RunTimeException) are unchecked, so the javac tool ignores them.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is from Jeanne Boyarsky & Scott Selikof book for OCA Java SE 8 Programmer I study guide
 
Veena Pointi
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Please always tell us where such quotes come from. Chapter 6 isn't sufficient information for us to find the source.
IllegalArrgumentException and RuntimeException (not RunTimeException) are unchecked, so the javac tool ignores them.



Sorry . It is from Jeanne Boyarsky & Scott Selikof book .
 
Veena Pointi
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Ron.
 
knowledge is the difference between drudgery and strategic action -- tiny ad
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic