aspose file tools*
The moose likes Java in General and the fly likes Why can't we write throw new Exception(); without try catch block ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Why can Watch "Why can New topic
Author

Why can't we write throw new Exception(); without try catch block ?

devasis majhi
Greenhorn

Joined: Dec 29, 2012
Posts: 9
When we can write throw new ArithmeticException(); without a try catch block why can't we write throw new Exception(); without try catch block.
To generalize we can throw a RuntimeException without try catch block but we can't throw a checked Exception without try catch block. What is the reason behind it?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Do you know the essential difference between an Exception and a RuntimeException? Have a look at the Java Tutorials, which explains it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why can't we write throw new Exception(); without try catch block ?