I'm looking to figure out the answer to this problem here.
First off,
blah[abc] = blah[abc].replaceAll("(.*) (.*)", "$2, $1");
Can someone explain to me what the (.*), $2 and $1 are?
Secondly, when I nest that within a for statement in order to reverse two parts of a string, I am hit with an exception error. I was wondering if anybody knew why that is.
Thanks
Edit: This is the error I receive
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 at ChangeNames.main(ChangeNames.java:21)