java练习篇 求输出最大值
总结:没有把数据输入。是数组-----把要输入的数据放在数组里。错在这里
import java.util.Scanner; public class shibai { public static void main(String[] args) { Scanner c = new Scanner(System.in); int a[] = new int[5]; int max = a[0]; for (int i = 0; i < a.length; i++) { System.out.println("请输入" + "第" + (i + 1) + "个数"); a[i] = c.nextInt(); if (max < a[i]) { max = a[i]; } } System.out.println("笨蛋结果是:" + max); } }