Thats the Code
import java.util.Scanner;
/*Test*/
class Hello {
public static void main(String[] args) {
System.out.println("Hallo");// Test
System.out.println("Taschenrechner");
double holaninos=420;
System.out.println("Meine Variable ist "+holaninos);
Scanner input = new Scanner(System.in);
System.out.println("Gib die erste Zahl ein ");
double zahl1=input.nextInt();
System.out.println("Gib die zweite Zahl ein ");
double zahl2=input.nextInt();
double zahl3=zahl1*zahl2;
System.out.println("Ergebnis: " +zahl3);
System.out.println("Bitte gib den Radius ein ");
double radius = input.nextInt();
double flaeche = (double) (radius * radius * Math.PI);
System.out.println("flaeche " + flaeche);
double umfang = (double) (radius * 2 * Math.PI);
System.out.println("umfang " + umfang);
}
}
Thats the error message
Exception in thread "main" java.util.InputMismatchException
at java.base/java.util.Scanner.throwFor(Scanner.java:939)
at java.base/java.util.Scanner.next(Scanner.java:1594)
at java.base/java.util.Scanner.nextInt(Scanner.java:2258)
at java.base/java.util.Scanner.nextInt(Scanner.java:2212)
at Hello.main(Hello.java:12)
I have the same Problem when use Float instad of double but when im entering numbers without a comma it works. It also works when I use int instead of double.