From e58face1613781c178cc498fa01306b84a3b42c7 Mon Sep 17 00:00:00 2001 From: fdai7446 <––fdai7446@fhfddvz1.rz.hs-fulda.de> Date: Fri, 10 Feb 2023 16:20:47 +0100 Subject: [PATCH] =?UTF-8?q?try=20catch=20f=C3=BCr=20eingabe()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Taschenrechner.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Taschenrechner.java b/Taschenrechner.java index 921a25e..dd1d3ac 100644 --- a/Taschenrechner.java +++ b/Taschenrechner.java @@ -61,7 +61,12 @@ public class Taschenrechner { static int eingabe() { Scanner scan = new Scanner(System.in); - int intScan= scan.nextInt(); + + try{ + int intScan= scan.nextInt(); + }catch(Exception e){ + System.out.println("Fehler bei der Eingabe!"); + } // scan.close();