当我运行下面给出的代码时,出现以下消息。这意味着什么?在这种情况下如何克服它?Java程序中的异常
异常线程 “main” java.lang.ArrayIndexOutOfBoundsException:0 在ifDemo.main(ifDemo.java:5)
public class ifDemo {
public static void main (String [] args)
{
int x= Integer.parseInt(args[0]);
double half=0.0;
if (x!=0)
{
half=x/2.0;
System.out.println(x+ "/2 = "+half);
}
if (x==0)
{
System.out.println("The value of x is "+x);
}
int y=x*5;
char grade='F';
if(y>=85)
{
grade='A';
}
if (y>=70 && y<85)
grade='C';
System.out.println("y= "+y+ "and grade equal to "+grade);
}
}
我正在通过Eclipse IDE运行它。 – josh 2013-04-21 07:03:20
看看这个[链接](http://stackoverflow.com/questions/7574543/how-to-pass-console-arguments-to-application-in-eclipse)。这对你有帮助。 – Maximin 2013-04-21 07:10:55