Guest User

Untitled

a guest
Aug 3rd, 2015
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Program {
  4.     public static void main(String args[]) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         while (true) {
  7.             System.out.print("Input a string: ");
  8.             try {
  9.                 String input = scanner.nextLine();
  10.                 SomeObject x = new SomeObject(input);
  11.                 break;
  12.             } catch (IllegalArgumentException iae) {
  13.                 System.out.print("Try again: ");
  14.             }
  15.         }
  16.  
  17.         while (true) {
  18.             // inne rzeczy do przetworzenia
  19.         }
  20.     }
  21. }
  22.  
  23. class Main {
  24.     public static void main(String args[]) {
  25.         Program main = new Program();
  26.         main.run();
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment