SWT301_-_FA_2024_-_PE1_2961.webp
HongThao85

SWT301_-_FA_2024_-_PE1_2961.webp

Zoom
1234567 7
public class fileProcessor (
private BufferedReader reader;private String FilePath;
public void openFile (String filePath) {
try {
reader new BufferedReader (new FileReader (filePath));
if (filePath != null || filePath.isEmpty()) { System.out.println("File opened successfully");
}
} catch (IOException e) {
System.out.println("Error opening file: " + e.getMessage());
public void readFile() {
String line;
try {
while ((line = reader.readLine()) != null) {
System.out.println(line);
} catch (IOException e) {
8
9
10
11
12
13
}
14
15
16
17
18
19
20
21
22
23
24
25
}
26
27
28
29
30
31
32
}
33
34
}
35
System.out.println("Error reading file: " + e.getMessage());
} finally {
reader.close();
public void processFile() { openFile (FilePath);
System.out.println("Processing file...");if (FilePath == null) {
System.out.println("Invalid file path");
return;
readFile();
Question 2 (5 points):
+ 100%
Close
  • Like
Reactions: huyQ
Chưa có bình luận nào.

Thông tin

Category
SWT301
Thêm bởi
HongThao85
Ngày thêm
Lượt xem
5,245
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
SWT301_-_FA_2024_-_PE1_2961.webp
File size
195.7 KB
Dimensions
1920px x 1000px

Share this media

Back
Bên trên Bottom