Skip to content

Instantly share code, notes, and snippets.

@muthugit
Created April 16, 2017 06:45
Show Gist options
  • Save muthugit/265c975085e9d5f0b4d7c7fe5f3d04cc to your computer and use it in GitHub Desktop.
Save muthugit/265c975085e9d5f0b4d7c7fe5f3d04cc to your computer and use it in GitHub Desktop.
import java.util.*;
public class Palindrome {
public static void main(String args[]) {
String original, reverse = "";
original = "ABCCBA1";
int length = original.length();
for (int i = length - 1; i >= 0; i--)
reverse = reverse + original.charAt(i);
if (original.equals(reverse))
System.out.println("Input string is a palindrome.");
else
System.out.println("Input string is not a palindrome.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment