Object Oriented Programming - Lesson 10: Exception Handling

Object Oriented Programming - Lesson 10: Exception Handling presents Exception & Exception handling, Exception classes hierarchy, try/catch/finally blocks, Throwing exceptions, Print a stack trace message, Making custom exceptions. | LESSON X. Exception Handling Trinh Thanh TRUNG (MSc) trungtt@ Objectives • After this lesson, students (learners) can: – Learn what an exception is, what have to do to handle exception – Distinguish the checked and unchecked exceptions – Implement the try-catch-finally blocks for catching and handling exceptions – Write methods that propagate exceptions. – Write programmer-defined exception classes. Content I. Exception & Exception handling II. Exception classes hierarchy III. try/catch/finally blocks IV. Throwing exceptions V. Print a stack trace message VI. Making custom exceptions I. Exception and Exception Handling 1. Exception 2. Exception Handling 1. Exception-What are errors? • There are three categories or types of errors: – (1) Syntax errors – (2) Logic errors (sometimes called: semantic errors) – (3) Runtime errors • Syntax errors arise because the rules of the language have not been followed. They are detected by the compiler. • Logic errors occur when a program doesn't perform the way it was intended to. • Runtime errors occur while the program is running if the environment detects an operation that is impossible to carry .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.