0
import java.util.Scanner;
public class DoDo{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        System.out.println("give me value of a and b");
        double a = in.nextDouble();
        double b = in.nextDouble();
        double dod = a + b;
        System.out.println(dod);
    }

}

Hello. I started my adventure with java yesterday. I did this simple calc and when i'm giving value a for example 2.5 eclipse gives me this

Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextDouble(Unknown Source)
at dodo.main(dodo.java:9)

I dont know what I'm doing wrong.

Infamous
  • 744
  • 11
  • 25
Przemek Broda
  • 476
  • 5
  • 13

0 Answers0