"SCJP 1.6版考題 151" 修訂間的差異
出自 陳富國維基館
(新頁面: 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{...) |
(無差異)
|
於 2013年3月30日 (六) 02:57 的最新修訂
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.
解答
Ans: B
解說:
4/5行只是宣告目錄、檔案 真正建立檔案的方法是createNewFile(),例子如145
|