title: Java: what are IOEXceptions in BufferedReader's readLine() for?
body: <p>I can "fix" the below exception with a try-catch loop but I cannot understand the reason. </p>
  
  <ol>
  <li>Why does the part "in.readLine()" continuosly ignite IOExceptions? </li>
  <li>What is really the purpose of throwing such exceptions, the goal probably not just more side effects?</li>
  </ol>
  
  <p><strong>Code and IOExceptions</strong></p>
  
  <pre><code>$ javac ReadLineTest.java 
  ReadLineTest.java:9: unreported exception java.io.IOException; must be caught or declared to be thrown
    while((s=in.readLine())!=null){
                        ^
  1 error
  $ cat ReadLineTest.java 
  import java.io.*;
  import java.util.*;
  
  public class ReadLineTest {
   public static void main(String[] args) {
    String s;
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    // WHY IOException here?
    while((s=in.readLine())!=null){
     System.out.println(s);
    }
   }
  }
  </code></pre>