返回列表 發帖
  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 intrger:");
  6.             int num = input.nextInt();
  7.         test(num);
  8.         System.out.println("Input an intrger:");
  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.         }else{
  18.                 System.out.println("The number is odd.");
  19.                
  20.         }
  21.     }
  22. }
複製代碼

TOP

返回列表