Palindrome String
import java.util.Scanner;
public class PalindromeString
{
public static void main(String[] args)
{
String st,revSt="";
int l;
Scanner sc=new Scanner(System.in);
System.out.print("Enter String:");
st=sc.nextLine();
l=st.length();
for (int i = l-1; i >= 0; i--)
{
char ch;
ch=st.charAt(i);
revSt=revSt+ch;
}
if(st.equals(revSt))
{
System.out.println("Palindrome String");
}
else
{
System.out.println("Not Palindrome String");
}
}
}
Output:
Enter String:asdsa Palindrome Stringjava tutorials learn java study java