What is the output?
- Compilation fails
#java #certificationquestion #ocp
According to Javadoc:
Path subpath(int beginIndex,
Returns a relative Path that is a subsequence of the name elements of this path.
The beginIndex and endIndex parameters specify the subsequence of name elements.
The name that is closest to the root in the directory hierarchy has index 0.
The name that is farthest from the root has index count-1.
The returned Path object has the name elements that begin at beginIndex and extend to the element at index endIndex-1.
This means a has index 0, b index 1, and c index 2.
This means also that subpath take between 1 inclusive and 2 exclusive so it takes only b.