Jump to content

can anyone tell me why i keep getting this error message?

- - - - -

  • Please log in to reply
2 replies to this topic

#1
robbieT1991

robbieT1991

    Newbie

  • Members
  • Pip
  • 2 posts
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.

#2
fread

fread

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 787 posts
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.

Perfection of means and confusion of ends seem to characterize our age. Albert Einstein :confused:

#3
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
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