【发布时间】:2014-08-03 20:11:23
【问题描述】:
我正在使用这个程序并收到上述错误!
public class Src {
public static void main(String args[]) {
// TODO Auto-generated method stub
int a=Integer.parseInt(args[0]);
int b=Integer.parseInt(args[1]);
int c=a+b;
System.out.println(""+c);
}
}
【问题讨论】:
-
args 可能为空。检查这个docs.oracle.com/javase/tutorial/essential/environment/…
-
提供更多细节,你是如何执行代码的……
-
@shekharsuman 我在 Eclipse 上运行它...
-
@AbhishekKumarRao-您显然需要在 Eclipse 中为 main 方法设置参数! eclipse中有一个单独的过程。在 google.com 上搜索!
标签: java exception indexoutofboundsexception