What is a Java IOException?

Java Exception FAQ: What is a Java IOException?

An IOException can occur in a variety of ways when you try to access the local filesystem. In the following Java code segment an IOException can be thrown by the br.readLine() method, so a try/catch wrapper is used around that portion of code to trap (and arguably deal with) the potential problem:

BufferedReader br = new BufferedReader(new FileReader(f));
String s = null;
try
{
  while ((s = br.readLine()) != null)
  {
    System.out.println(s);
  }
}
catch (IOException e)
{
  // deal with the error here ...
  e.printStackTrace();
}