[問題] java初學者出入問題
這是我寫的程式
import java.util.Scanner;
public class hw2 {
public static void main(String[]args)
{
int total,average;
Scanner scanner= new Scanner(System.in);
System.out.print("please input chinese score:");
int chinese= Integer.parseInt(args[0]);
System.out.print("please input math score:");
int math= Integer.parseInt(args[1]);
System.out.print("please input english score:");
int english= Integer.parseInt(args[2]);
total= chinese+math+english;
average= total/3;
System.out.println(chinese);
}
}
可是每次跑的時候他都會出現
please input chinese score:Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at hw2.main(hw2.java:19)
不知道哪裡出錯了@@ 可以幫我看一下嗎
謝謝喔
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.82.198.164
→
11/05 15:05, , 1F
11/05 15:05, 1F
→
11/05 16:01, , 2F
11/05 16:01, 2F
→
11/05 18:13, , 3F
11/05 18:13, 3F
討論串 (同標題文章)