Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
Lecture Introduction to Java programming - Chapter 13: Exception handling
Đang chuẩn bị liên kết để tải về tài liệu:
Lecture Introduction to Java programming - Chapter 13: Exception handling
Trung Dũng
68
50
ppt
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
When a program runs into a runtime error, the program terminates abnormally. How can you handle the runtime error so that the program can continue to run or terminate gracefully? This is the subject we will introduce in this chapter. | Chapter 13 Exception Handling Motivations When a program runs into a runtime error, the program terminates abnormally. How can you handle the runtime error so that the program can continue to run or terminate gracefully? This is the subject we will introduce in this chapter. Objectives To get an overview of exceptions and exception handling (§13.2). To explore the advantages of using exception handling (§13.3). To distinguish exception types: Error (fatal) vs. Exception (nonfatal), and checked vs. unchecked (§13.4). To declare exceptions in a method header (§13.5.1). To throw exceptions in a method (§13.5.2). To write a try-catch block to handle exceptions (§13.5.3). To explain how an exception is propagated (§13.5.3). To use the finally clause in a try-catch block (§13.6). To use exceptions only for unexpected errors (§13.7). To rethrow exceptions in a catch block (§13.8). To create chained exceptions (§13.9). To define custom exception classes (§13.10). Exception-Handling Overview Quotient Run QuotientWithIf Run QuotientWithException Run Show runtime error Fix it using an if statement What if the runtime error occurs in a called method? Exception Advantages QuotientWithMethod Run Now you see the advantages of using exception handling. It enables a method to throw an exception to its caller. Without this capability, a method must handle the exception or terminate the program. Handling InputMismatchException InputMismatchExceptionDemo Run By handling InputMismatchException, your program will continuously read an input until it is correct. Exception Types System Errors System errors are thrown by JVM and represented in the Error class. The Error class describes internal system errors. Such errors rarely occur. If one does, there is little you can do beyond notifying the user and trying to terminate the program gracefully. Exceptions Exception describes errors caused by your program and external circumstances. These errors can be . | Chapter 13 Exception Handling Motivations When a program runs into a runtime error, the program terminates abnormally. How can you handle the runtime error so that the program can continue to run or terminate gracefully? This is the subject we will introduce in this chapter. Objectives To get an overview of exceptions and exception handling (§13.2). To explore the advantages of using exception handling (§13.3). To distinguish exception types: Error (fatal) vs. Exception (nonfatal), and checked vs. unchecked (§13.4). To declare exceptions in a method header (§13.5.1). To throw exceptions in a method (§13.5.2). To write a try-catch block to handle exceptions (§13.5.3). To explain how an exception is propagated (§13.5.3). To use the finally clause in a try-catch block (§13.6). To use exceptions only for unexpected errors (§13.7). To rethrow exceptions in a catch block (§13.8). To create chained exceptions (§13.9). To define custom exception classes (§13.10). .
TÀI LIỆU LIÊN QUAN
Lecture Introduction to Java programming - Chapter 1: Introduction to computers, programs, and Java
Lecture Introduction to programming with Java - Chapter 1: Introduction to computers and programming
Lecture Introduction to programming with Java - Chapter 3: Java basics
Lecture Introduction to Java programming - Chapter 2: Elementary programming
Lecture Introduction to Java programming - Chapter 16: Event-driven programming
Lecture Introduction to programming with Java - Chapter 6: Object-oriented programming
Lecture Introduction to programming with Java - Chapter 7: Object-oriented programming – Additional details
Lecture Introduction to Java programming - Chapter 15: Graphics
Lecture Introduction to programming with Java - Chapter 16: GUI programming basics
Lecture Introduction to Java programming - Chapter 8: Objects and classes
crossorigin="anonymous">
Đã 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.