TAILIEUCHUNG - Java Concepts 5th Edition phần 3

Đoạn tiếp theo cho thấy làm thế nào để kiểm tra xem một phương pháp có chứa một thẻ @ cụ thể bằng cách sử dụng thẻ được xây dựng trong mẫu Phương pháp. Trong ví dụ này, chúng tôi đang kiểm tra "phản đối": | Java Concepts 5th Edition 14. Assuming the String variable river holds the value Mississippi what is the value of river . substring 1 2 2 - 3 Productivity Hint Reading Exception Reports You will often have programs that terminate and display an error message such as Exception in thread main String index out of range -4 at ava 1444 at ava 16 An amazing number of students simply give up at that point saying it didn t work or my program died without ever reading the error message. Admittedly the format of the exception report is not very friendly. But it is actually easy to decipher it. When you have a close look at the error message you will notice two pieces of useful information 1. The name of the exception such as StringIndexOutOfBoundsException 2. The line number of the code that contained the statement that caused the exception such as Homeworkl. j ava 16 The name of the exception is always in the first line of the report and it ends in Exception. If you get a StringIndexOutOfBoundsException then there was a problem with accessing an invalid position in a string. That is useful information. The line number of the offending code is a little harder to determine. The exception report contains the entire stack trace that is the names of all methods that were pending when the exception hit. The first line of the stack trace is the method that actually generated the exception. The last line of the stack trace is a line in main. Often the exception was thrown by a method that is in the standard Chapter 4 Fundamental Data Types Page 39 of 69 Java Concepts 5th Edition library. Look for the first line in your code that appears in the exception report. For example skip the line that refers to 1444 The next line in our example mentions a line number in your code Homeworkl. j ava. Once you have the

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.