提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
偶数
/* *来 自 N o w J a v a . c o m - 时 代 Java */ public class Main { public static void main(String[] args) { int[] numbers = new int[]{1,2,3,4,5,6,7,8,9,10}; for(int i=0; i < numbers.length; i++){ if(numbers[i]%2 == 0) System.out.println(numbers[i] + " is even number."); else System.out.println(numbers[i] + " is odd number."); } } }