我不断收到异常错误。这是一个简单的代码。为什么我收到异常错误?
class ThirdProgram
{
public static void main(String[] args)
{
System.out.println("Hello out there.");
System.out.println("I will add two numbers for you.");
System.out.println("Enter two whole numbers on a line.");
int n1, n2;
Scanner keyboard = new Scanner(System.in);
n1 = keyboard.nextInt();
n2 = keyboard.nextInt();
System.out.println("The sum of those two numbers is");
System.out.println(n1 + n2);
}
}