Given that the current directory is empty, and that the user has read and write privileges to the current
directory, and the following:
1. import java.io.*;
2. public class Maker{
3. public static void main(String args){
4. File dir = new File("dir");
5. File f = new File(dir, "f");
6. }
7. }
Which statement is true?
A. Compilation fails.
B. Nothing is added to the file system.
C. Only a new file is created on the file system.
D. Only a new directory is created on the file system.
E. Both a new file and a new directory are created on the file system.
答案:B
參考:10-3 File類別
---------------------------------------------------------------------
4. File dir = new File("dir"); //建立dir物件
5. File f = new File(dir, "f"); //建立f物件
但都沒有呼叫...create new file 或 mkdirs
所以沒有東西新增到檔案系統中
沒有留言:
張貼留言