By: Ash Printer Friendly Format
Question:Execute the following code in an empty directory. What is the result?
1. File f1 = new File("dirname");
2. File f2 = new File(f1, "filename");
A. A new directory called dirname is created in the current working directory.
B. A new directory called dirname is created in the current working directory. A new file called filename is created in the directory.
C. A new directory called dirname and a new file called filename are created, both in the current working directory.
D. A new file called filename is created in the current working directory.
E. No directory is created, and no file is created.
Answer:E is correct. Constructing an instance of the File class has no effect on the local file system.
Most Viewed Articles (in Certification )
Latest Articles (in Certification)
Comment on this tutorial
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews