Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. private static void buildNewTrain() {
  2. Scanner scannerTrainId = new Scanner(System.in);
  3. System.out.println("Bitte geben sie die Zug ID an");
  4. scannerTrainId.nextInt();
  5. int trainId = 0;
  6. boolean undefined = true;
  7. while (undefined) {
  8. try {
  9. trainId = scannerTrainId.nextInt();
  10. undefined = false;
  11. } catch(Exception e) {
  12. scannerTrainId.next();
  13. System.out.println("Eingabe ungueltig bitte versuchen sie es erneut.");
  14. }
  15. System.out.println(trainId);
  16.  
  17. }
  18.  
  19. System.out.println(trainId);
  20. Train trainNewResult= new Train(0, (char) 0, 0, 0);
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement