Write a program in java to check whether an string is palindrome or not
without using reverse method.
public class Palindrome2
{
public static void main(String[] args)
{
String s="malayalam";
String s2="";
for(int i=s.length()-1;i>=0;i--)
s2=s2+s.charAt(i);
if(s.equals(s2))
System.out.println(s+" is palindrome");
else
System.out.println(s+" is not palindrome");
}
}
Write a program in java to check whether an string is palindrome or not without using reverse method [All Java Interview Programs] |
0 Comment to "Write a program in java to check whether an string is palindrome or not without using reverse method"
Post a Comment