When running the program you entered 3 arguments "red", "green" and "blue". When dealing with arrays in java you must remember ALL ARRAYS IN JAVA ARE ZERO BASED therefore
args[0] becomes "red",
args[1] becomes "green" and
args[2] becomes "blue".
When the program entcounters line 8 above at runtime it looks for args[3] which has never been created therefore you get an
ArrayIndexOutOfBoundsException at runtime.