PRO192_-_SP_2023_-_BL5_-_FE_118.webp
hoangduc2001

PRO192_-_SP_2023_-_BL5_-_FE_118.webp

Multiple Choices
(Choose 1 answer)
Suppose the current directory does not contain a sub-directory named "dir"What happens when you try to compile and run the following application?
10. import java.io.*;
11. public class Main {
12. public static void main(String argv[]) {
13.try {
14.File d = new File("dir");
15.File f = new File(d, "fi.txt");
16.if(!f.exists()) {
17 f.createNewFile();
18 }
19. }catch (IOException e) {
20 e.printStackTrace();
21.}
22. }
23. }
A. Line 17 is never executed.
B. Line 17 throws an exception at runtime.
C. Line 15 throws an exception at runtime.
D. Line 17 creates a directory named "dir" and a file "fi.txt" within it.
E. Line 15 creates a directory named "dir" and a file "fi.txt" within it.

Thông tin

Category
PRO192
Thêm bởi
hoangduc2001
Ngày thêm
Lượt xem
2,852
Lượt bình luận
18
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom