I want to initialize Double
variable before String
and another Double
after String
, but I get a InputMismatchException
.
The Simple Program:
import java.util.*;
public class testing {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
double balance;
String accountType;
double h1;
balance=in.nextDouble();
accountType=in.nextLine();
h1=in.nextDouble();
System.out.println(balance);
System.out.println(accountType);
System.out.println(h1);
in.close();
}
}
Error Output:
Exception in thread "main" java.util.InputMismatchException