tailieunhanh - Introduction to java programming: Chapter 17 - Exceptions and Assertions

Introduction to java programming: Chapter 17 - Exceptions and Assertion's Objectives is to know what is exception and what is exception handling; distinguish exception types; declare exceptions in the method header; throw exceptions out of a method. | Chapter 17 Exceptions and Assertions Chapter 9 Inheritance and Polymorphism Chapter 17 Exceptions and Assertions Chapter 18 Binary I O Chapter 6 Arrays Chapter 19 Recursion Liang Introduction to Java Programming Fifth Edition c 2005 Pearson Education Inc. All rights reserved. 0-13-148952-6 Objectives To know what is exception and what is exception handling . To distinguish exception types Error fatal vs. Exception non-fatal and checked vs. uncheck exceptions . To declare exceptions in the method header . To throw exceptions out of a method . To write a try-catch block to handle exceptions . To explain how an exception is propagated . To rethrow exceptions in a try-catch block . To use the finally clause in a try-catch block . To know when to use exceptions . To declare custom exception classes Optional . Liang Introduction to Java Programming Fifth Edition c 2005 Pearson Education Inc. All 2 rights reserved. 0-13-148952-6 2 Syntax Errors Runtime Errors and Logic Errors Y ou learned that there are three categories of errors syntax errors runtime errors and logic errors. Syntax errors arise because the rules of the language have not been followed. They are detected by the compiler. Runtime errors occur while the program is running if the environment detects an operation that is impossible to carry out. Logic errors occur when a program doesn t perform the way it was intended to. Liang Introduction to Java Programming Fifth Edition c 2005 Pearson Education Inc. All 3 rights reserved. .