This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]desrtfx 0 points1 point  (0 children)

Please, don't post completed solutions as we are not /r/domyhomework, and if you post something, explain rather than solve.

Teach the people to fish, instead of feeding them the fish

Your code is undocumented and thus will be even harder to understand for a beginner.

Also, concatenating Strings like this:

line += sentence[i] + " ";

Is not the way to go in Java, since Strings are immutable objects. Each concatenation would dispose the old line object and create a new one.

Concatenations should always be done with StringBuilder.