JavaExceptions - CIS3023: Programming Fundamentals for CIS...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Exception Handling in Java Course Lecture Slides 7th July 2010 Admitting error clears the score, and proves you wiser than before. -- Arthur Guiterman Errors Syntax errors arise because the rules of the language have not been followed. detected by the compiler. Logic errors leads to wrong results and detected during testing. arise because the logic coded by the programmer was not correct. Runtime errors Errors Code errors Divide by zero Array out of bounds Integer overflow Accessing a null pointer (reference) Programs crash when an exception goes untrapped , i.e., not handled by the program. Runtime Errors O bj1 0 55 Exception An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions . Exception = Exceptional Event 66 Exception Handling Java exception handling is a mechanism for handling exception by detecting and responding to exceptions in a systematic, uniform and reliable manner . Any exceptions not specifically handled within a J ava program are caught by the J ava run time environment Exceptions A Method in Java throws exceptions to tell the calling code: Something bad happened. I failed . Exceptions are objects of Exception or Error class or their subclasses. Exception Classes LinkageError Error AWTError AWTException Throwable ClassNotFoundException VirtualMachineError IOException Exception RuntimeException Object ArithmeticException NullPointerException IndexOutOfBoundsException Several more classes Several more classes Several more classes IllegalArgumentException Unchecked Exceptions LinkageError Error AWTError AWTException Throwable ClassNotFoundException VirtualMachineError IOException Exception RuntimeException Object ArithmeticException NullPointerException IndexOutOfBoundsException Several more classes Several more classes Several more classes IllegalArgumentException System Errors LinkageError Error AWTError AWTException Throwable ClassNotFoundException VirtualMachineError IOException Exception RuntimeException Object ArithmeticException NullPointerException IndexOutOfBoundsException Several more classes Several more classes Several more classes IllegalArgumentException System errors are thrown by JVM and represented in the Error class . The Error class describes internal system errors. Such errors rarely occur. If one does, there is little you can do beyond notifying the user and trying to terminate the program gracefully. Runtime Exceptions LinkageError Error AWTError AWTException Throwable ClassNotFoundException...
View Full Document

Page1 / 32

JavaExceptions - CIS3023: Programming Fundamentals for CIS...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online