Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- public class IntegerCheck {
- public static void main(String[] args) {
- BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
- String s = null;
- int x = -1;
- while (true) {
- try {
- s = in.readLine();
- }
- catch (Exception e) {
- }
- if (s == null) continue;
- try {
- x = new Integer(s);
- }
- catch (Exception e) {
- }
- if (x == 1 || x == 2) break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement