我不断error message
从输出中得到一个
Exception in thread "main java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextDouble(Unknown Source)
at test1.TC1.main(TC1.java:11)
但在顶部它没有任何错误
package test1;
import java.util.Scanner;
public class TC1 {
public static void main(String[] args){
double name, age, answer;
Scanner IN = new Scanner (System.in);
System.out.println("Whats yor name?");
name = IN.nextDouble();
System.out.println("How old are you?");
age = IN.nextDouble();
answer = age + name;
System.out.println(answer);
}
}