Skip to content

Instantly share code, notes, and snippets.

@969rishi
Created September 28, 2023 22:21
Show Gist options
  • Save 969rishi/f2536b4afac109f13c423ef77c580cbc to your computer and use it in GitHub Desktop.
Save 969rishi/f2536b4afac109f13c423ef77c580cbc to your computer and use it in GitHub Desktop.
Palindrome Word Solution in Java
/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
public class Main
{
public static void main(String[] args) {
String input = "manonam";
String originalInput = input;
String reverseString = "";
for (int i = input.length()-1; i > -1; i--) {
reverseString = reverseString + input.charAt(i);
}
System.out.println(reverseString );
if (originalInput.equalsIgnoreCase(reverseString)) {
System.out.println(originalInput+" is Palindrome Word ✓✓✓");
}else System.out.println(originalInput+" is Not a Palindrome Word XXX");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment