+ 2
Can anyone tell what is wrong in the code
I am trying to print if the string is a palindrome or not. https://code.sololearn.com/c4RkO0iwd67F/#java
7 Answers
+ 5
At the end of the for loop, s2 is a character and not the reversed string
+ 5
Here, I modified your code a little, added some comments in to explain my perspective, hope it help somehow :)
https://code.sololearn.com/ctp3Xu2O3WSa/?ref=app
+ 4
@Gordie,
Done! and thanks for reminding me ;)
+ 2
Got the code corrected..Thanku all
+ 1
you need to get rid of the extra curly braces. also seems u are doing operation on the same string that u are using for comparison. keep ur S1 string unchanged and use the char arry or temp string. please try to print ur S1 string before you do comparison in ur current code. this might give you an idea if you have done anything wrong with ur S1. using copy.char[] is not going to help either. look at the code here, this might give u some insights.
https://code.sololearn.com/cmhk7V5crzko/?ref=app