Keith Lynn wrote:I ran your programs and got false on both
Joel Christophel wrote:Your for loop syntax is off. You need to replace the commas with semicolons. The code you posted doesn't even compile for me.
Joel Christophel wrote:Once you fix that, your first example should work. For example,"cat".substring(2, 3) returns "t" even though there is no index of 3, so you shouldn't run into errors using substring(int, int) the whole time.
Joel Christophel wrote:Also, the String class has a built in method called toCharArray that converts a String into an array of characters. If you really need an array of Strings, though, you could use toCharArray and then convert that to a String array.