String[] args parameter: java.lang.ArrayIndexOutOfBoundsException

If you use the args-array you have to give the programm some parameters from outside for example from the console.

So open the console and go to the directory where the .java file is and compile it manually with

javac Addnumber.java

Now you should see a .class file there.

Than write a call like this:

java Addnumber 5 9 

your arguments would be 5 and 9.

Also write the classname in capitals

Leave a Comment