Obviously it has revealed the flaw since they mentioned being confused by the results they are getting. A better solution would be to use a method that returns a boolean: false as soon as it finds a...
Type: Posts; User: Junky
Obviously it has revealed the flaw since they mentioned being confused by the results they are getting. A better solution would be to use a method that returns a boolean: false as soon as it finds a...
if (sentence.length()<26)
That if statement will handle empty Strings ie if user hits return without entering anything. Thus the check for an empty String is redundant.
To explain my point...
I think it is a bad design. One problem I can see is that a StringIndexOutOfBoundsException will occur if the sentence is longer than alphabet. If the issue mentioned above is fixed then it will...