0
public class ScannerNextDoubleExample4 {    
    public static void main(String args[]){       
        double value;  
        Scanner scan = new Scanner(System.in);       
        System.out.print("Enter the numeric value : ");  
        value = scan.nextDouble();  
        System.out.println("Double value : " + value +" \nTwice value : " + 2.0*value );  
        scan.close();  
    }    
} 

Upon entering a decimal number, the program crashes. ("java.util.InputMismatchException") Why does this happen? Thanks for any help!

leisi
  • 1

0 Answers0