Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Program {
- public static void main(String args[]) {
- Scanner scanner = new Scanner(System.in);
- while (true) {
- System.out.print("Input a string: ");
- try {
- String input = scanner.nextLine();
- SomeObject x = new SomeObject(input);
- break;
- } catch (IllegalArgumentException iae) {
- System.out.print("Try again: ");
- }
- }
- while (true) {
- // inne rzeczy do przetworzenia
- }
- }
- }
- class Main {
- public static void main(String args[]) {
- Program main = new Program();
- main.run();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment