I would like to receive a Double from the user and handle the exception thrown in case the user didn\'t input a double/int; in that case I\'d like to ask the user to insert
The reason is that it keeps reading the same value over and over, so ending in your catch clause every time.
You can try this:
private static double inputAmount() {
Scanner input = new Scanner(System.in);
while (true) {
System.out.println("Insert amount:");
try {
return input.nextDouble();
}
catch (java.util.InputMismatchException e) {
input.nextLine();
}
}
}