AllSame.java

/******************************************************************************
 *  Compilation:  javac AllSame.java
 *  Execution:    java AllSame a b c
 *
 *  Prints "The are the same" if a = b = c 
 *  and "The are not the same." otherwise.
 *
 *  % java AllEqual 10 10 10
 *  The are not the same.
 *
 *  % java AllEqual 10 20 10
 *  The are not the same.
 *
 ******************************************************************************/
public class AllSame { 
    public static void main(String[] args) {
        int a = Integer.parseInt(args[0]);
        int b = Integer.parseInt(args[1]);
        int c = Integer.parseInt(args[2]);

        if (a == b && a == c) {
            System.out.println("The are the same.");
        }
        else {
            System.out.println("The are not the same.");
        }

    }
}

 

posted @ 2018-09-17 15:41  盆古  阅读(224)  评论(0编辑  收藏  举报