Which object reads tokens and lines from an opened file?
FileIOExceptionScannerString[]Scanner is the object that supplies the read methods, so it is what actually pulls tokens and lines out of an opened file.
Explanation
A path name goes into File(String str), and that File object is then passed to Scanner(File f). After that connection is made, every read comes from the scanner: nextInt(), nextDouble(), nextBoolean(), next(), and nextLine() are all its methods.
- A is not correct: A
Filereceives the path name and is handed to theScannerconstructor, but it has no read methods of its own. - B is not correct:
IOExceptionis the exception type a file-reading method header declares it may throw when opening the named file fails. - D is not correct: A
String[]is whatsplit(",")hands back after a line has already been read; it is a result, not a reader.