Cannot evaluate because of org.eclipse.debug.core.DebugException: Attempt to access illegal array index: 1.
Says debug session in the mainReadQuotes() function ! then what is use of endDate= args?
This could be because we aren’t passing any arguments when directly debugging the
mainReadQuotes() method in contrast to debugging a test. You can try to evaluate
args to see if this is actually the case.
You can try debugging a test that calls the
mainReadQuotes() method from the
The index of array arguments you are trying to access is out of bound. That is why you are getting this error. I hope I may be somewhat helpful to you
Meaning of enddate = args1 is that you dont need to hardcode it.
It is the same as module 1 where many were stuck because they were hardcoding the file name
The thing that I was missing :
Frequently, a Java program needs to handle arguments specified on the command-line. For example, you might want to run your program like this:
java MyProgram 1234 www.caltech.edu "olive festival"
Somehow, your program needs to be able to access these values from the command-line. The way your program can do this is through the String argument passed to your main method. Note that the argument is an array of strings. Each element of the array contains one of the values specified on the command-line.
In the above example, the args array will contain the following values:
- args.length = 3
- args = “1234”
- args = “www.caltech.edu”
- args = “olive festival”
Thanks to @nabhanpv. Your answer led me to the thing that I was missing.