Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Java on Eclipse calculator issue(Java on Eclipse calculator issue)
Java on Eclipse calculator issue [message #1740253] Wed, 10 August 2016 18:41
Samuel Oliveira is currently offline Samuel OliveiraFriend
Messages: 2
Registered: August 2016
Junior Member
I'm having this is problem on eclipse, after i make the program run it shows this:

Enter first number:
3.3
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 BuildingaBasicCalculator.main(BuildingaBasicCalculator.java:9)


Here is the program of the calculator:

import java.util.Scanner;
class BuildingaBasicCalculator {

public static void main (String args[]){
Scanner sam = new Scanner(System.in);
double fnum, snum, answer;

System.out.println("Enter first number: ");
fnum = sam.nextDouble();

System.out.println("Enter second number: ");
snum = sam.nextDouble();

answer = fnum + snum;
System.out.println(answer);
sam.close();
}

}
Previous Topic:Eclipse IDE : features to include?
Next Topic:Imposible to select the classes methods with Eclipse Neon JSDT
Goto Forum:
  


Current Time: Sun Jun 16 21:18:49 GMT 2019

Powered by FUDForum. Page generated in 0.02929 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top