Java while loop query [closed]

In your second code block you are first checking if the first character is the same as the last.

If it isn’t, return false.

Else, return true.

So this isn’t going to be a valid palindrome check. It only checks if the first and last letters are the same or not and ignores the letters in the middle.

Browse More Popular Posts

Leave a Comment