Level 93 Level 95
Level 94

[Quiz] File Handling


13 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Ignore?
What is the difference between File and Files, Path and Paths?
Path: this class replace File as representation of file or directory when working with NIO.2. It is a lot more powerful than File.
Which is an interface - Path or Paths?
Path is an interface. Paths is a concrete class that contains static methods to create Path object and implements some of its methods.
Path p1 = new Path("/user/jack/mydoc.txt");
A and B are correct.
Path convertedPath = file.toPath();
How do you convert a File to Path and vice versa?
Path p = Paths.get("my/file/doc.txt");
How do you create a file using NIO.2 classes?
What does the DirectoryStream interface allow you to do in Java7?
The DirectoryStream interface lets you iterate through a directory. Not recursive though...
Files.isExecutable(path);
How to know whether a file is readable, writable, executable in Java7?
How is the BasicFileAttributes class different from BasicFileAttributesView class?
The BasicFileAttributesView class is used for setting or updating attributes, whereas BasicFileAttributes class is used to read these values. You call them as follows:
What is the use of FileVisitor interface in Java7 NIO.2?
Java provides a SimpleFileVisitor. You extend it and override one or more methods. Then you can call Files.walkFileTree, which knows how to recursively look through a directory structure and call methods on a visitor subclass.
What does PathMatcher interface do in Java?
PathMatcher interface helps to find files that matches a certain pattern in a specific filesystem. usage:
false
True or False: A Java source code file can defined more than one public class or interface?
What is the use of WatchService interface in Java?
The WatchService interface is used to watch for certain file event in a specific path, and take specified actions if that event occurs. For example if you wanted to wait until a specific file …
TERMINATE Terminate..What is the difference between File and Files, Path and Paths?
Path: this class replace File as representation of file or directory when working with NIO.2. It is a lot more powerful than File.