Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Scanner.java:840)
at java.util.Scanner.next(Scanner.java:1461)
at java.util.Scanner.nextDouble(Scanner.java:2387)
at BMCSystems.BelfastElectricity.main(BelfastElectricity.java:61)
Java Result: 1e are electric accounts i dont know how
here is the code that it crashes on:
double newDiscount;
System.out.println("what dicount is this account intitled to?");
newDiscount=keyB.nextDouble();
//seting newDiscount equal to the users input.
can anyone tell me why i keep getting this error message?
Started by robbieT1991, Nov 27 2011 11:37 AM
2 replies to this topic
#1
Posted 27 November 2011 - 11:37 AM
|
|
|
#2
Posted 27 November 2011 - 02:04 PM
From the java docs:
Quote
public class InputMismatchException extends NoSuchElementException
Thrown by a Scanner to indicate that the token retrieved does not match the pattern for the expected type, or that the token is out of range for the expected type.
Thrown by a Scanner to indicate that the token retrieved does not match the pattern for the expected type, or that the token is out of range for the expected type.
Perfection of means and confusion of ends seem to characterize our age. Albert Einstein :confused:
#3
Posted 27 November 2011 - 10:53 PM
Propably using ',' instead of '.' or the other way around. Depends on where Java thinks you live and is most appropriate for that language.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









