Question: 1 A Scanner object can be used to both read and write text files in Java O True O False 2 File I/O operations may

1 A Scanner object can be used to both read and write text files in Java O True O False 2 File I/O operations may throw checked exceptions True O False 3 The print and println methods can be used to write data to a PrintWriter object. True O False 4 An output file should always be closed when you're done using it or data may be lost True O False 5 Which of the following declares a valid Scanner object to read an input file named myData.txt? O Scanner in - new Scanner(new File("myData.txt")); Scanner in new ScannerC"myData.txt"); Scanner in new File("myData.txt"); Scanner in-new Scanner(new PrintWriter("myData.txt")); 6 Which of the following declares a valid PrintWriter object that represents an output file named myOutput.txt? O PrintWriter out-new PrintWriter(new File(" myOutput.txt")); O PrintWriter out = new Scanner("myOutput.txt"); O PrintWriter out-new PrintWriter("myOutput.txt"); PrintWriter out -new FileC"myOutput.txt")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
