Class Notes (836,153)
Canada (509,662)
CSC207H1 (40)
Lecture

oct15c.docx

1 Page
54 Views
Unlock Document

Department
Computer Science
Course
CSC207H1
Professor
Diane Horton
Semester
Fall

Description
OCTOBER 15  Generic stacks w/ interface put in oct10c instead  Exceptions o Exceptions report exceptional conditions: unusual, strange, disturbing. o These conditions deserve exceptional treatment: not the usual go-to-the-next-step, plod-onwards approach. o Therefore, understanding exceptions requires thinking about a different model of program execution.  Exceptionsin Java o To “throw an exception” Throw Throwable; o To “catch an exception” and deal with it: try { statements } catch (Throwable parameter) { // The catch belongs to the try. statements } o To say you aren’t going to deal with exceptions (or may throw your own): accessMod returnType methodname (parameters) throws Throwable {...} o Analogy:  Throw:  I'm in trouble, so I throw a rock through a window, with a message tied to it.  Try:  Someone in the following block of code might throw rocks of various kinds. All you catchers line up ready for them  Catch:  If a rock of my kind comes by, I'll catch it and deal with it.  Throws:  I’m warning you: if there’s trouble, I may throw a rock.  Even though there are only two new statement types, this changes the whole
More Less

Related notes for CSC207H1

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit