title: Error "unreported exception java.io.ioexception must be caught or declared to be thrown" in Java class
body: <p>I am getting a "unreported exception java.io.ioexception must be caught or declared to be thrown" for some reason. I throw an I/O exception in this method:</p>
  
  <pre><code>    private void setChar() throws IOException
      {
          try
          {
              int data = in.read(); 
              if(data==-1)
              {
                  eof = true; 
              }
              else
              {
                  currentChar = (char) data; 
              }
          }
          catch (IOException e) 
          {
              System.exit(0);
          }
      }
  </code></pre>
  
  <p>And I call the method here (in the constructors):</p>
  
  <pre><code>private BufferedReader in;
  private char currentChar;
  private boolean done;
  
  public Scanner(InputStream inStream)
  {
      in = new BufferedReader(new InputStreamReader(inStream));
      done = false;
      getNextChar();
  }
  
  public Scanner(String inString)
  {
      in = new BufferedReader(new StringReader(inString));
      done = false; 
      setChar();
  }
  </code></pre>
  
  <p>Am I calling / throwing the exception wrong?</p>