Access over 20 million homework & study documents

Lecture9

Content type
User Generated
Rating
Showing Page:
1/33

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/33

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/33

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 33 pages?
Access Now
Unformatted Attachment Preview
Exception Handling LESSON 9 Lesson Structure •Introduction to Exceptions •Try-catch, throws, throw keywords •Final, finally and finalize •Custom Exceptions Exception •An unexpected, unwanted event that disturbs the normal flow of the program is called exception. Eg: Interruptedexception ◦ Numberformatexception ◦ FileNotFoundException •It is highly recommended to handle exceptions and the main objective of exception handling is graceful termination of the program. •Exception handling doesn’t mean repairing an exception͘ Providing an alternative way to continue rest of the program normally is the concept of exception handling. Exception Example Eg: Our programming requirement is to read data from a remote file located at London. At runtime if London file is not available, our program should not be terminated abnormally. We have to provide some local file to continue rest of the program normally. This way of defining alternatives is nothing but exception handling. Try { // read data from a remote file at London } catch (FileNotFoundException e) { // use a local file and continue the rest of the program normally. } Runtime Stack Mechanism •For every thread JVM will create a runtime stack. •Each and every method call performed by that thread will be stored in the corresponding stack. •Each entry in the stack is called stack frame or activation record. •After completing every method call the corresponding entry from the stack will be removed. ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Great content here. Definitely a returning customer.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4