Java Error “Exception in thread ”main“ java.lang.ArrayIndexOutOfBoundsException”

后端 未结 3 1424
旧巷少年郎
旧巷少年郎 2021-01-26 05:59

Here is this simple code from my book it produces error message in netbeans and in compile version (.class) version running through Command prompt.

Error Message

3条回答
  •  萌比男神i
    2021-01-26 06:49

    If args[0] is causing an ArrayIndexOutOfBoundsException, then you didn't supply any command-line parameters. Test args.length; if it's 0, then handle the error.

提交回复
热议问题