- import java.util.*;
- class JPA02 {
- static Scanner keyboard = new Scanner(System.in);
- public static void main(String[] args) {
- System.out.print("Input:");
- int x = keyboard.nextInt();
- int y = keyboard.nextInt();
- test(x,y);
- System.out.println(" ");
- System.out.print("Input:");
- int a = keyboard.nextInt();
- int b = keyboard.nextInt();
- test(a,b);
- }
-
- public static void test(int num1,int num2) {
- if(num1>num2){
- System.out.printf("%d is lager than %d",num1,num2);
- }else if(num2>num1){
- System.out.printf("%d is lager than %d",num2,num1);
- }
-
- }
-
-
- }
複製代碼 |