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

Checked exception thrown by JVM, not programmer

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide on page 317 it says:

Checked exceptions have Exception in their hierarchy but not RuntimeException. They must be handled or declared. They can be thrown by the programmer or by the JVM.



Can someone give me an example of a checked exception that is thrown by the JVM?

The book gives some examples of exceptions that are thrown by the JVM, but they are either unchecked exceptions (ArithmeticException, ArrayIndexOutOfBoundsException, ClassCastException, NullPointerException) or errors (ExceptionInInitializerError, StackOverflowError, NoClassDefFoundError).
 
author & internet detective
Posts: 40035
809
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JVM really means "or the built in java libraries" here. When reading a file, an IOException is thrown when problems occur. This is thrown by Java (vs the programmer.)

It's hard to come up with good examples because they are all outside the scope of the OCA!
 
For my next feat, I will require a volunteer from the audience! Perhaps this 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