wood burning stoves*
The moose likes Beginning Java and the fly likes Why Exceptions are handled in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Why Exceptions are handled in java?" Watch "Why Exceptions are handled in java?" New topic
Author

Why Exceptions are handled in java?

siva chaitanya
Ranch Hand

Joined: Jul 05, 2011
Posts: 59
[Added indentation]

In the above code, developer only wrote a wrong syntax and he only handled the Arithmetic Exception. Why to write irrelevant code we can remove those lines of code instead of handling the exception with try and catch.
Rohan Deshmkh
Ranch Hand

Joined: Aug 31, 2012
Posts: 127
The above program was developed because he(the developer) wanted to explain the concept of exception handling.
Many times the user would not be giving value himself, and at that time this concept may come to help.
changu mani
Ranch Hand

Joined: Aug 31, 2012
Posts: 30
Most Applications are not simple enough. It is difficult to ensure that inputs go correct all the time.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37941
    
  22
siva chaitanya wrote: . . . In the above code, developer only wrote a wrong syntax . . .
That is not incorrect syntax. It is unusual logic.

You have already had a good explanation from Rohan Deshmkh, so there is no point my repeating it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why Exceptions are handled in java?
 
Similar Threads
Exception Handling!!!
Exception Chaining
explain the output
Exception and finally
2 objects EXCEPTION