我只是Java的初學者。請幫助執行這個簡單的程序。它拋出一個異常:線程中的異常。我無法執行此程序
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at sum.main(sum.java:7)
方案
class sum {
public static void main(String args[]){
int a,b,c;
a=Integer.parseInt(args[0]);
b=Integer.parseInt(args[1]);
c=a+b;
System.out.println(c);
}
}
你怎麼稱呼這個程序?使用IDE或控制檯? – Blobonat
@Blobonat Console – Jijin
然後看看Davide Lorenzo MARINO的回答 – Blobonat