Đang chuẩn bị liên kết để tải về tài liệu:
Lecture Java Programming Language: Files and Exception Handling - Ho Dac Hung

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

Lecture Java Programming Language: Files and Exception Handling has main content such as what is a file, handling exception, the filereader and bufferedreader classes, he filewriter and bufferedwriter classes, object serialization, | Files and Exception Handling Ho Dac Hung 1 What is a File A file is a collection of related data stored on a persistent medium such as a hard disk or a CD. Persistent simply means lasting. File often store data used by an application. File are also used to store the data generated by an application. 2 The File Class The File class part of the java.io package is used for creating an object that represents a file. A File object can be used to create a new file test for the existence of a file and delete a file. File String f createNewFile delete exists 3 Handling Exception An exception is an error affecting program execution. If an exception is not taken care of or handled the application abruptly terminates. Although many types of exceptios may still require program termination an exception handler can allow an application to terminate gracefully by providing the user with an informative error message. 4 Handling Exception An exception handler us a block of code that performs an action when an exception occurs. The try-catch-finally statement can be used to write an exception handler. try catch exception err code finally 5 The File Streams A file must be associated with a stream in order to perform operations such as reading the contents writing over existing contents and adding to the existing contents. A stream processes characters and in Java streams are implementes with classes. 6 The File Streams The file stream keeps track of the file position which is the point where reading or writing last ocurred. File streams are used to perform sequantial file access with all the reading and writing perfoemed onc character after another or one line after another. 7 The FileReader and BufferedReader Classes The FileReader amd BufferedReader classed both from java.io package are used together to read the contents of an existing file. The FileReader class is used to create an input file stream. Next the BufferedReader class is used to read text from the stream. FileReader .

Đã 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.