Steve Luke wrote:You are reading in the second line, the error probably occurs at this line 28 (in the post), where you are getting the charAt(i). The cause is: you never reset i to 0, so you are trying to read characters from the index where the previous line ends, not from the start of the new line.
Steve Luke wrote:OUtOfMemoryError is an Error, not an Exception. Errors tend to be un-recoverable, so you generally don't catch them.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton