Win a copy of Svelte and Sapper in Action this week in the 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

What are checked exceptions

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was wondering if anyone knew what Checked Exceptions are.
Any help is greatly appreciated. Thanks.
-Jay
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the section of the JLS that deals with exceptions.
http://java.sun.com/docs/books/jls/second_edition/html/exceptions.doc.html#44121
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jay
A checked exception is any exception that, if it can be thrown you have to account for in your code. Either by throwing it or catching it.
The exception classes look (simplified) like this:
Throwable is the ancestor class of them all, a class must extend Thowable to throw an exception. From Throwable there are two classes Error and Exception, and from Exception there is RunTimeException and a slew of others.
The Error class and the RunTimeException classes are considered unchecked excpetions. Normally they are things that the programmer can not account for in code. Running out of memory, and other system type errors. These are all unchecked, the compiler doesn't check to see if you have handled them. All of the classes that inherit from Exception (other than RunTimeException) are considered checked, you have to account for their possibility in your code or the compiler will complain.
hope that helps

Dave
check this out for a more detailed explaination: http://java.sun.com/docs/books/tutorial/essential/exceptions/catchOrDeclare.html
 
Jay Kay
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help. It helps a lot.
-Jeelani
 
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic