error handling
This commit is contained in:
parent
ed8d85c34b
commit
d49b8247ab
@ -129,8 +129,13 @@ public class WetterApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int readInputInt() {
|
private int readInputInt() {
|
||||||
|
int ret = 0;
|
||||||
System.out.print("> ");
|
System.out.print("> ");
|
||||||
int ret = scanner.nextInt();
|
try {
|
||||||
|
ret = scanner.nextInt();
|
||||||
|
} catch(Exception e) {
|
||||||
|
System.out.println("Fehler: Es wurde keine Zahl eingegeben.");
|
||||||
|
}
|
||||||
scanner.nextLine();
|
scanner.nextLine();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user