Đang chuẩn bị liên kết để tải về tài liệu:
Object-Oriented Programming Lecture 6: Exceptions

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

Object-Oriented Programming Lecture 6: Exceptions What is an exception? Catching and handling exceptions, Specifying the exceptions thrown by a method, How to throw exceptions, Advantages of exceptions. | Object-Oriented Programming Lecture 6: Exceptions Dr. Lê H!ng Ph"#ng -- Department of Mathematics, Mechanics and Informatics, VNUH August 2012 1 Thursday, August 9, 12 Content ✦ What is an exception? ✦ Catching and handling exceptions ✦ Specifying the exceptions thrown by a method ✦ How to throw exceptions ✦ Advantages of exceptions ✦ Exercises 2 Thursday, August 9, 12 What is an exception? ✦ An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program’s instructions. ✦ When an exception occurs within a method, the method creates an exception object and hands it off to the runtime system. ✦ ✦ The exception object contains information about the error (its type, the state of the program when the error occurred). Creating an exception object and handing it to the runtime system is called throwing an exception. 3 Thursday, August 9, 12 What is an exception? ✦ When an exception is thrown, the runtime system attempts to find something to handle it. ✦ A set of possible “somethings” is the ordered list of methods that had been called to get to the method where the error occurred. ✦ This list of methods is known as call stack. 4 Thursday, August 9, 12 What is an exception? ✦ The runtime system searches the call stack for a method that can handle the exception. ✦ ✦ ✦ The block of code that handles the exception is called exception handler. The type of exception object thrown must match the type that can be handled by the handler. When the handler is found, the runtime passes the exception to the handler. 5 Thursday, August 9, .

TÀI LIỆU LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.