Java

Palindrome only using String functions

PalindromeWithString.java

class PalindromeWithString 
{
 public static void main(String[] args) 
 {
  String str="dad";

  String rev="";
  
  int l=str.length();

  for (int i=l-1;i>=0 ;i-- )
  {
   rev=rev+str.charAt(i);
  }
  
  if (str.equals(rev))
  {
   System.out.println("String is a Palindrome");
  }
  else
  {
   System.out.println("String is not a Palindrome");
  }
 }
}

Related Posts

language_img
Java

Editable JTable

Apr 20, 2015

language_img
Java

Working of String

Apr 19, 2015

Table Of Contents

;