B 2.5.1 Worksheet Java Answers
1. Word Count: Explanation: This code uses a Scanner to read the file word by word. input.next() reads the next word, and the wordCount is incremented. The try-with-resources statement ensures the Scanner is closed automatically. 2. Line Reversal: Explanation: This code reads the file line by line using a BufferedReader and stores each line in an ArrayList. Then, it reverses the ArrayList using Collections.reverse()...