Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MatchInteger {
- public static void main(String[] args) {
- int[] password = {22, 33, 44};
- Scanner in = new Scanner(System.in);
- boolean match = true;
- for (int p: password) {
- try {
- if (p != new Integer(in.nextInt())) match = false;
- }
- catch (Exception e) {
- match = false;
- break;
- }
- }
- in.close();
- if (match) System.out.println("一致");
- else System.out.println("不一致");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement