Solved

Which Code Fragment Creates a Stream of Lines from a File

Question 42

Multiple Choice

Which code fragment creates a stream of lines from a file named "data.txt"?


A) try(Stream<String> linesData = Files.lines(Paths.get("data.txt") ) ) { ...};
B) try(Stream linesData = Files.lines(Paths.get("data.txt") ) ) { ...};
C) try(Stream<String> linesData = Files.lines("data.txt") ) { ...};
D) try(Stream<String> linesData = Paths.get(Files.lines("data.txt") ) ) { ...};

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions