Advertisement
cd62131

Match Integer

Feb 2nd, 2014
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.56 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.InputStreamReader;
  3.  
  4. public class MatchInteger {
  5.   public static void main(String[] args) {
  6.     int[] password = {22, 33, 44};
  7.     BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  8.     boolean match = true;
  9.     for (int p: password) {
  10.       try {
  11.         if (p != new Integer(in.readLine())) match = false;
  12.       }
  13.       catch (Exception e) {
  14.         match = false;
  15.         break;
  16.       }
  17.     }
  18.     if (match) System.out.println("一致");
  19.     else System.out.println("不一致");
  20.   }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement