Given the code fragment:
public static void main(String[] args) {
Path file = Paths.get("D:\\company\\report.txt");
try (SeekableByteChannel sbc = Files.newByteChannel(file,new OpenOption[]
What is the result if the report.txt file contains
Welcome to the world of Java?
A.
The file contains the first five characters.
B.
The file contains the first four characters.
C.
The contents of the file remain unchanged.
D.
A NonWritableChannelException is thrown at runtime.
Explanation:
The truncate line will not change the file since the file size is less than 30.
Reference: Interface SeekableByteChannel