Java OCA OCP Practice Question 511

Question

You 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 directory dirname.
  • 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.


E.

Note

Constructing an instance of the File class has no effect on the local file system.




PreviousNext

Related