public class Array1{public static void main(String[] args) {int odd = 0, even = 0;int[] array = new int[] { 1, 4, 7, 8, 9, 10, 0, 0, 14, 19, 24, 29 };for (int i : array) {if (i % 2 == 0) {even++;}else{odd++;}}System.out.printf("偶数=%d,奇数=%d", even, odd);}}请写出运行结果
从键盘输入10个数,存入一维数组中,求最大值及最大值所有下标。Scanner sc=new Scanner(System.in);int[] num = new __(1)__;for (int i = 0; i <= 9; i++){System.out.println("请输入第" + (i+1) + "个数:" );__(2)__= Integer.parseInt(sc.nextLine());}int max = __(3)__;//max用于存储最大值int imax= ___(4)_;//imax用于存储最大值所在下标for (int i = 1; i <= 9; i++){if ( _(5)___){max = num[i];imax = i;}}System.out.println("最大值为:" + max + ",下标为:" + imax);