Problem scenario
You are running a Groovy program.
Here is your code:
def input = System.console().readLine ‘Please provide some input: ‘
def x = input
def boardArray = new String[2]
boardArray[0] = “”
boardArray[1] = “”
boardArray[1] = “$x”
println boardArray[1]
When you run it (i.e., with groovy foobar.groovy), you get this error:
Caught: java.lang.ArrayStoreException: org.codehaus.groovy.runtime.GStringImpl
java.lang.ArrayStoreException: org.codehaus.groovy.runtime.GStringImpl
What should you do?
…