Unless i move the variable increment to above the call to .bark first.
But then the output errors to
last dog's name is Bart
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
My code appears to be the same as that shown above?
I removed an additional } found before the bark because I was getting error thrown otherwise
Dog.java:30: error: class, interface, or enum expected
You probably thought you had done that already because of the closing brace at line 22, but the matching opening brace for that one is way back at line 6. In fact you don't have matching braces in the posted code (3 opening braces, 4 closing braces) so it shouldn't even compile.