Given the code fragment:
public class App {
public static void main (String [] args) {
path path = paths.get(“C\\educations\\institute\\student\\report.txt”);
system.out.printIn(“getName(0): %s”, path.getName(0));
system.out.prinIn(“subpath(0, 2): %s” path.subpath(0, 2));
}
What is the result?
A.
getName (0): C:\
subpath(0, 2): C:\education\report.txt
B.
getName (0): C:\
subpath(0, 2): education\institute
C.
getName(0): education
subpath(0, 2: education\institute\student
D.
getName(0): education
subpath(0, 2): education\institute
E.
getName(0): report.txt
subpath (0, 2): institute\student
Explanation:
The getName(int index) method returns a name element of this path as a Path
object.
The subpath(int beginIndex, int endIndex) method returns a relative Path that is a subsequence of
the name elements of this path.
Reference: java.nio.file.Path
Hello.This article was extremely motivating, particularly because I was searching for thoughts on this topic last Sunday.
http://www.bastcilkdoptb.com/