一个简单数组问题!!!
程序代码:
package wwww; public class huhuhu { public static void main(String[] args) { int i, j; int intArray[] = {4, 2, 7, 9, 1, 6}; int m = intArray.length; for (i = 0; i < m - 1; i++) { for (j = i + 1; j < m; j++) { if (intArray[i] > intArray[j]) { int t = intArray[i]; intArray[i] = intArray[j]; intArray[j] = t; } for (i = 0; i < m; i++) { System.out.println(intArray[i] + " "); } } } } }
Exception in thread "main" java.lang.ArrayIn
at wwww.huhuhu.main(huhuhu.java:11)
我该怎么改,应该是数组越界了吧!!!!!!!!!!
[[it] 本帖最后由 hanzhu3366 于 2008-4-29 16:39 编辑 [/it]]