![]() |
VOOZH | about |
IOException is a type of checked exception which occurs during input/output operation. BufferedReader is used to read data from a file, input stream, database, etc. Below is the simplified steps of how a file is read using a BufferedReader in java.
This file system reading can fail at any time for many reasons. It may occur due to the file deleted or viruses in the file. Sometimes BufferedReader takes data from a network stream where the reading system can fail at any time.
So this type of error can occur in input operation when a BufferedReader is used. This is why a buffered reader throws IOException.
Below is an example of BufferedReader use
Input: a = 5, b = 3 Output: 8
Implementation:
Output:
If the file is deleted from the server-side while reading the input from the server-side, IOException is thrown.