One Off Index ErrorThe first item from the String is not being used or printed. Remember that like other things in the Java language, the index for a String starts at zero, not one. As you can no doubt figure out, the last index of a String is length “1. This does not affect the actual length of the String. It remains at exactly the number of characters that are in the String. Incorrect String RepresentationWhen I print out an Object, I see something that looks like this: classname@8e41. To get a better String representation for an object to print out, you must override the toString() method for the class you are trying to print. Otherwise, the default toString() method will be used that is defined on the Object class. |