Chapter

File Input

From ComputerScienceOne by Dr Chris Bourke

Concepts

  1. How can a Scanner read input from a file?

    "Java provides several different classes and utilities that support manipulating and processing files. In general, most file operations may result in an IOException, a checked exception that must be c

  2. How does try-with-resources simplify closing file input resources?

    "We could have placed all this code within one large try-catch block with perhaps a finally block to close the Scanner once we were done to ensure that it would be closed regardless of any exceptions.

  3. When should you use specialized classes for binary file input?

    "Using the Scanner class to do file input offers a more abstract interaction with a file. It also uses a buffered input stream for performance. Binary files can still be read using nextByte(). However

File Input | ComputerScienceOne | Bifalgorithm | Bifalgorithm