{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

WDD_lec_07 - Web Design Development Lecture 7 Intro to...

Info icon This preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Web Design & Development Lecture 7
Image of page 1

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

View Full Document Right Arrow Icon
Intro to Exceptions
Image of page 2
Types of Programming Errors Three types of error: Syntax Errors – arise because the rules of the language are not followed. Runtime Errors – arise because the program tries to perform an operation that is impossible to carry out. Logic Errors – arise because the program does perform the way it was intended to. Syntax errors are caught by the compiler, and fixed before the program is run. Logic Errors are detected by testing, and are fixed through debugging. Runtime Errors cause Exceptions and may be handled at runtime.
Image of page 3

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

View Full Document Right Arrow Icon
Exceptions An exception is an event that describes an unusual or erroneous situation at runtime. Exceptions are wrapped up as objects A program can deal with an exception in one of three ways: i gnore it handle it where it occurs handle it an another place in the program An error is also represented as an object in Java, but usually represents an unrecoverable situation and should not be caught
Image of page 4
Why Use Exceptions? Uses of exception handling Process exceptions from program components Handle exceptions in a uniform manner in large projects Remove error-handling code from “main line” of execution What if Exception is not handled? Might terminate program execution
Image of page 5

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

View Full Document Right Arrow Icon
Exceptions Types Two Types Unchecked Subclasses of RuntimeException and Error. Does not require explicit handling Run-time errors are internal to your program, so you can get rid of them by debugging your code For example, null pointer exception; index out of bounds exception; division by zero exception; ...
Image of page 6
Exceptions Types Two Types Checked Must be caught or declared in a throws clause Compile will issue an error if not handled appropriately Subclasses of Exception other than subclasses of RuntimeException. Other arrive from external factors, and cannot be solved by debugging Communication from an external resource – e.g. a file server or database
Image of page 7

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

View Full Document Right Arrow Icon
Throwable Exception Error IOException ArrayIndexOutOfBoundsException InputMismatchException NullPointerException Runtime Exception AWTError ThreadDeath ClassCastException OutOf MemoryError ArithmeticException Checked Exceptions UnChecked Exceptions Error
Image of page 8
How are Java Exceptions Handled
Image of page 9

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

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern