Monday, August 16, 2010

Files

Courtesy of Sun Web Learning Center


Which two about the java.io.File class are true? (Choose two.)

A This class can be used to create both files AND directories.
B The mkdir() method takes an argument that represents the file.
C Only empty directories can be deleted using the delete() method.
D Only empty directories can be renamed using the renameTo() method.
E The createNewFile() method takes an argument that represents the file.

A and C are correct. Both the mkdir() and createNewFile() methods are invoked using an existing instance of class File. The renameTo() method can rename non-empty directories.

No comments:

Post a Comment