返回列表 發帖
  1. import java.util.*;
  2. public class JPA02 {
  3.     static Scanner input = new Scanner(System.in);
  4.     public static void main(String[] args) {
  5.             System.out.println("Input an integer:");
  6.             int num = input.nextInt();
  7.         test(num);
  8.             System.out.println("Input an integer:");
  9.             num = input.nextInt();
  10.         test(num);
  11.     }
  12.    
  13.     static void test(int num) {
  14.             if(num%2==0)
  15.             {
  16.                     System.out.println("The number is even.");
  17.             }
  18.             else
  19.             {
  20.                     System.out.println("The numbr is odd.");
  21.                    
  22.             }
  23.     }
  24. }
複製代碼

TOP

返回列表