ID:263271
 
Problem description:
Well I looked at some tutorials and was just writing code, but I get this an error in line 8 say unreported Exception in java.io or something...Does anyone see anything wrong?
Code:
import java.io.*;

public class Main
{

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

public static void main(String args[])
{

int[] TestArray;
String[] NameArray[];

TestArray = new int[10];
String CharName="";

TestArray[0] = 100;
TestArray[1] = 200;
System.out.println("Test 1");
System.out.println(TestArray[0]+TestArray[1]);
System.out.println("Test 2");
while(CharName!=null)
{
System.out.print("Please enter a name:");
String input = stdin.readLine();

}

}
}




Hmmm... do you need that static on BufferedReader? I'm not sure, but that may be causing errors, making the compiler think it's a method instead of an object
1 - Should be public final, not public static.
2 - You need to tell Java if the code that you're writing can throw an exception, or you need to handle it. If you don't care, you can just squelch the exception by doing this:

public static void main(String args[]) {
try {
// Code goes here
}
catch(Exception e) {
System.out.println("Exception occurred");
System.exit(1);
}
}