Table of Contents
Java Programming
Virtual Lecture 17
This lecture
Recall System.java’s objects in and out
PPT Slide
Recall System.java’s objects in and out
Recall global variables are available for use
InputStream.java
ReadByte.java
reads a char from the keyboard
ReadByte.java
reads a char from the keyboard
ReadByte.java
reads a char from the keyboard
PPT Slide
ReadByte.java
reads a char from the keyboard
PPT Slide
PPT Slide
PPT Slide
PPT Slide
PPT Slide
PPT Slide
ReadByte.java
reads a char from the keyboard
PPT Slide
PPT Slide
PPT Slide
ReadByte.java
reads a char from the keyboard
PPT Slide
Special Characters
PPT Slide
PPT Slide
PPT Slide
ReadByte.java
reads a char from the keyboard, Step 15
ReadByte.java
reads a char from the keyboard, Step 16
Recall Cast char to int and int to char
PPT Slide
ReadByte.java
reads a char from the keyboard, Step 19
System.in.read() Summary
This lecture
Recall types of errors
Focus on execution errors
Handling execution errors
Exception handling
ReadByte.java
reads a char from the keyboard
ReadByte.java
reads a char from the keyboard
ReadByte.java
reads a char from the keyboard
DivException1.java
dividing by zero causes an error
DivException2.java
example of a Java exception
DivException2.java
example of try--catch
DivException3.java
example of try—catch--finally
DivException4.java example of
try—catch—finally with return
DivException5a.java
example of try--finally
DivException5b.java
example of a Java exception
Multiple catch clauses
This lecture
Recall InputStream.java
Exception.java
Class Hierarchy for Exception
Recall Exception in catch
Using IOException
Class Hierarchy for IOException
Class Hierarchy, Object class
Object.java
TestObject.java
Class Hierarchy, Throwable class
Throwable.java
Throwable.java, Constructors
Throwable.java, toString()
TestThrowable.java
Throwable.java, getMessage()
TestGetMessage.java
This lecture
Throwable.java, printStackTrace()
TestStackTrace.java
PPT Slide
PPT Slide
TestStackTrace.java
PPT Slide
PPT Slide
PPT Slide
PPT Slide
PPT Slide
PPT Slide
Recall TestStackTrace.java
PPT Slide
PPT Slide
PPT Slide
PPT Slide
PPT Slide
TestStackTrace.java
Throwable.java
Class Hierarchy, Exception class
Exception.java
Probable contents of Exception.java
TestException.java
writing our own exception class
The throw command
TestThrowing.java
throwing exceptions (throw)
ThrowStack.java
ThrowStack.java
PPT Slide
PPT Slide
Exception handler
PPT Slide
PPT Slide
PPT Slide
PPT Slide
ThrowStack.java
This lecture
Ways to handle errors
Error-checking: the Square6 program
Error-signaling: the Square7a program
Recall ReadByte.java
reads a character from the keyboard
Error-trapping: Modify ReadByte.java
reads a digit from the keyboard
Ways to handle errors
This lecture
|