How would I write code to check if a word is a palindrome or not using Boolean and a for statement?? Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How would I write code to check if a word is a palindrome or not using Boolean and a for statement?? Java

I've been struggling with this problem for some time so any help is appreciated.

14th Apr 2020, 11:00 PM
Zoe
Zoe - avatar
1 Answer
+ 2
Take a string input and iterate from end to start. Use the charAt() method and append those characters to a string variable. Later use the equals method for comparison.
14th Apr 2020, 11:24 PM
Avinesh
Avinesh - avatar