Scanner输入数据类型的问题
package TaskOfJavabooksCap2;import java.util.Scanner;
public class areaAndVolumeOfaCylinder {
public static void main(String[] args) {
// create a scanner object
Scanner input = new Scanner(System.in);
//Prompt user to enter 2 numbers of a cylinder
System.out.print("Enter the radius and length of a cyllinder ");
double num1 = input.nextDouble();
double num2 = input.nextDouble();
double area = num1*num1*3.14;
System.out.println("The area is "+ area);
System.out.println("The area is "+ area*num2 );
}
}
请问各位大佬们,我这个scanner输入为什么只能针对整数,对于小数就会出现 InputMismatchException