Hello

i was wondering how this piece of code executed without any problems

import java.io.*;
public class InputToDouble
{
public static void main (String[] args) throws IOException
{
String charData;
double value;

BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));

System.out.println("Enter a double:");

charData = stdin.readLine();

value = Double.parseDouble( charData ) ;
System.out.println("value: " + value +" twice value: " + 2*value );
}
}


whereas this piece of code

import java.io.*;
/**
*
* @author Moyeen
*/
public class mywelcome {
public static void main (String[] args)
{
String charData;
double value;

BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));

System.out.println("Enter a double:");

charData = stdin.readLine();

value = Double.parseDouble( charData ) ;
System.out.println("value: " + value +" twice value: " + 2*value );
}
}

gives the error
mywelcome.java [21:1] unreported exception java.io.IOException; must be caught or declared to be thrown

chardata = stdin.readline();

why is the readline causing an exception?