【发布时间】:2018-06-25 01:39:21
【问题描述】:
我一直在用 java 编写一些代码,但我遇到了一个错误,我不知道为什么,因为我刚刚运行了一些类似这样的代码,它工作得很好。
String [] month = {"Jan", "Feb", "Mar", "Apr", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
double [] temperature ={54.3, 57.0, 62.5, 67.6, 74.3, 79.2, 80.9, 80.4, 77.8, 70.1, 62.8, 56.3};
double [] precipitation ={3.5, 3.4, 4.3, 2.9, 3.2, 6.8, 6.1, 6.6, 4.4, 2.5, 2.2, 2.6};
for( int index = 0; index < temperature.length; index++)
{
System.out.print(""+month [index] +". "+temperature [index]+" "+precipitation [index]);
System.out.println();
}
【问题讨论】:
-
May我提醒你什么? -
它是什么?......
-
没关系,我刚得到它 lmao
-
不是,那个帖子启发了我问这个问题,因为我有同样的问题,只是出于不同的原因。
标签: java arrays indexoutofboundsexception