帮忙看看这小小的代码!急急!
import javax.swing.JOptionPane;
public class ArraySort
{
public static void main(String args[])
{
int [] obj=new int[5];
int i=0;
System.out.println("请输入"+obj.length+"个数");
for (i=0;i<obj.length;i++)
{
obj[i]=Integer.parseInt(args[i]);
}
int temp=0;
for (i=0;i<obj.length-1;i++)
{
for (int j=i+1;j<obj.length;j++)
{
if (obj[i]<obj[j])
{
temp=obj[i];
obj[i]=obj[j];
obj[j]=temp;
}
}
}
for (i=0;i<obj.length;i++)
System.out.print(obj[i]+" ");
System.out.println();
}
}
编译时没错,运行时出错。
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at ArraySort.main(ArraySort.java:12)