the indices used when accessing lines from a file using Files.readAllLines() are zero-based. This means:
The first line of the file has an index of 0.
The second line has an index of 1.
The third line has an index of 2, and so on.
Answer is B (text1-text2-text3), when input file has text in 3 different lines, in input file.
text1
text2
text3
And Index out of bounds occur since there are only 2 items.
B correct. Java uses 0 indexing so we only have items 0 (text1), 1 (text2), and 2 (text3). Index 3 outa bounds.
upvoted 2 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
SrinivasJasti
2 weeks, 2 days agoxplorerpj
6 months, 3 weeks agosupersquax
11 months, 2 weeks ago