JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Hello guys, this is my Java palindrome checker.
/*
* If you don't know what a palindrome is, It's a word that will spell the same thing when reveresed.
* Example: tacocat reversed is tacocat
*/
import java.util.Scanner;
public class palindromeChecker {
public static void main(String[] args) {
System.out.println("Please enter a string to be palindrome checked.\n");
Scanner sc = new Scanner(System.in);
boolean isPalindrome = false;
String str = sc.nextLine();
System.out.println(str+"\n");
String reversed = "";
for (int i = str.length() - 1; i >= 0; i--) {
reversed += str.charAt(i);
}
if (str.equalsIgnoreCase(reversed)) {
isPalindrome = true;
}
if (isPalindrome) {
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run