arg.. a new error occured. >.< this is my only notes/guide for the if else statement. =(
import java.io.*;
public class input{
public static InputStreamReader Reader=new
InputStreamReader(System.in);
public static BufferedReader input=new
BufferedReader(Reader);
public static void main(String args[]){
String name;
int age;
{
System.out.println("Enter name:");
name=input.readLine();
System.out.println("Enter age:");
age=Integer.parseInt(input.readLine());
if (age<=17){
System.out.println("Too young!");
} else if(age>=18){
System.out.println("You're ready to vote!");
}
}
}
}
The error says:
- unreported exception java.io.IOException; must be caught or
declared to be thrown line 12
- unreported exception java.io.IOException; must be caught or
declared to be thrown line 14
age=Integer.parseInt(input.readLine());
It seems like my teacher forgot something or I copied the code wrong. =( Last edited by rapperhuj; Sep 6th, 2007 at 10:48 pm.