File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes It is concerned to exception handling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "It is concerned to exception handling" Watch "It is concerned to exception handling" New topic
Author

It is concerned to exception handling

KS(Bangalore)
Greenhorn

Joined: Aug 13, 2002
Posts: 1
public void perform() throws ArthimaticException
{
some code
}
whenever this method is being acessed this arthimatic exception should b caught but ArthimaticException is a RuntimeException.AS per theory even we should not care of these RuntimeExceptions it should work.Can u clarify the diffrence between CheckedExceptions and UncheckedExceptions?
Thanks in Advance
KS(Bangalore)
Michael Matola
whippersnapper
Ranch Hand

Joined: Mar 25, 2001
Posts: 1746
    
    2
Closing thread in Orion and moving to Java in General (Beginner).
Also, KS(Bangalore, Please adjust your displayed name to meet the JavaRanch Naming Policy. You can do so here.
Have you tried searching the forums for previous posts on checked and unchecked exceptions?
[ August 13, 2002: Message edited by: Michael Matola ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10

whenever this method is being acessed this arthimatic exception should b caught but ArthimaticException is a RuntimeException.

If the code in the method throws an ArithmeticException, this method will pass it along to the calling method where it may or may not be caught, depending on the code in the calling method. The fact that this is a RuntimeException is irrelevant to this sequence of events.

AS per theory even we should not care of these RuntimeExceptions it should work. Can u clarify the diffrence between CheckedExceptions and UncheckedExceptions?

A RuntimeException is an exception that the programmer should be able to handle by checking in advance ... for example, verify that the divisor will never be zero before you use it as the denominator the int.

A checked exception is one that the programmer may have no control over. Good examples are found in IO. StreamCorruptedException, FileNotFoundException, EOFException ...


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
AS per theory even we should not care of these RuntimeExceptions it should work.
The advice I've read usually argued that Unchecked Runtime Exceptions were generally not supposed to be caught and handled. They indicate a mistake in the program and the program should have been written to prevent such errors. Checked exceptions should be caught and handled as they often represent problems that the programmer does not have control over and the program should be reasonably able to recover from these problems.
Usually, these same advice givers agreed that the situation is not quite that black and white. For example, if a program gets input from the user in the form of a String that represents some integer value (say "1234"), the program could step through each character of the String and verify that it does indeed form an integer before using Integer.parseInt( String ) to get the number, thus avoiding the possible throwing of a Runtime Exception. But, most all programs with this type of conversion that I've seen just go straight to Integer.parseInt( String ) inside a try block and reasonably handle the possible Runtime Exception in a catch block.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: It is concerned to exception handling