• 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

Correct me if I wrong

 
Ranch Hand
Posts: 391
1
MySQL Database PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The exceptions thrown by API methods like NumberFormatException ,IllegalArgumentException,ArrayIndexOutOfBoundsException are programatically thrown.

and JVM thrown exceptions are StackOverflowError,NullPointerException,ClassCast exception
Although we can explicitly through these exceptions
 
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "programmatically thrown" and "JVM thrown"?
 
Greenhorn
Posts: 18
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can always throw anything which is throwable from your code. Throwable is at the top of the hierachy. So in this way you can throw any exception of error you want from your code and also catch the same. But it is recomonded that you only throw exception or error which is more relevant and easy to understand during debuging.
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mahtab Alam wrote:
The exceptions thrown by API methods like NumberFormatException ,IllegalArgumentException,ArrayIndexOutOfBoundsException are programatically thrown.



Two of them are. ArrayIndexOutOfBoundsException is thrown by the JVM, though, whenever you try to access an array index that doesn't exist.

You can throw any exception programmatically. But some are only thrown that way - meaning that somewhere in the source code (either yours or an API) there's a statement that says "throw new ...".
 
reply
    Bookmark Topic Watch Topic
  • New Topic