public class eg7 {
public static void main(String[] args){
int a[]={12,26,35,854,54,95,32,};
for(int i=0;i<a.length;i++){
int max=a[i];
for(int j=0;j<a.length;j++){
if(max<a[j]){

展开全部
收起
3回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
  • Noah

    15人对此回答表示赞同

    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7
    at eg7.main(eg7.java:15)
    请按任意键继续. . .
    ----------------------------------------------------
    错误信息如上,这是说你调用的主方法中,超出了数组的范围。
    问题出在最后的输出语句上,
    数组
    展开
    15
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • 丛林人

    10人对此回答表示赞同

    public static void main(String[] args) {
    int a[] = { 12, 26, 35, 854, 54, 95, 32, };
    for (int i = 0; i < a.length - 1; i++) {//改动一
    int max = a[i];
    for (int j = i; j < a.length; j++) {//改动2
    if (max < a[j]) {
    展开
    10
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • LanceCheng

    9人对此回答表示赞同

    楼主的a[]数组只有七个值,System.out.println(a[7]);
    数组下标越界了。
    展开
    9
    0回复
    发布于 6年前

    评论(0)

    收起评论

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部