[問題]出現ArrayIndexOutOfBoundsException無法執行??

看板java作者 (做人要樂天╰( ̄▽ ̄)╯)時間19年前 (2006/06/17 18:19), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
剛剛執行考試的範例程式 class Test{ String tName=""; String tMajor=""; void init(String str1, String str2){ tName=str1; tMajor=str2; } void display(){ System.out.println("tName: "+tName); System.out.println("tMajor: "+tMajor); } } class AAA{ public static void main(String args[]){ Test s1=new Test(); s1.init(args[0], args[1]); s1.display(); } } 編譯成功可是要執行時卻出現 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at AAA.main(AAA.java:17) 這是出現什麼問題呢??好像是arg[]的問題 拜託解答一下 謝謝~ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.116.128.180
文章代碼(AID): #14azTCVG (java)
文章代碼(AID): #14azTCVG (java)