String palindrome
Output:
StringPalindrome.java
package com.swain.cell;
public class StringPalindrome {
public static void main(String args[])
{
String original="Himanshu";
String rev="";
int length = original.length();
for ( int i = length - 1 ; i >= 0 ; i-- )
rev = rev + original.charAt(i);
if (original.equals(rev))
System.out.println(original+" is a palindrome.");
else
System.out.println(original+" is not a palindrome.");
}
}
// amazon ebay shopbob.com hotels.com canon newegg.com
Comments
Post a Comment