202比較大小

/******
檔名:JPA02.java
題目:TQC+ JAVA6物件導向程式設計 參考答案
時間:2015/06
作者:fang shi mai
******/
import java.util.Scanner;

public class JPA02
{
    static Scanner keyboard = new Scanner(System.in);
    
    public static void main(String[] args)
    {
        test();
        test();
    }
    public static void test()
    {
        int x;
        int y;
        System.out.println("Input:");
        x=keyboard.nextInt();
        y=keyboard.nextInt();
        if(x>y)
            System.out.println(x+" is larger than "+y);
        else if(y>x)
            System.out.println(y+" is larger than "+x);
    }
}

沒有留言:

張貼留言