Palindrom

Palindrom

public class Palindrom{
 public void isPalindrom(String str)
 {
  int length = str.length();
  boolean isPalin = true;
  for(int i=0;i<=(str.length()-1)/2;i++)
  {
   if(str.charAt(i)!=str.charAt(length-1))
   {
    isPalin = false;
   }

   length--;
   
  }
      System.out.println("Is Palindrom "+isPalin);
 }
}

Reactions

Post a Comment

0 Comments