<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sid Lohith</title>
    <description>The latest articles on DEV Community by Sid Lohith (@ranlohith).</description>
    <link>https://dev.to/ranlohith</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F220257%2F050b294b-fbb4-48fb-80a0-3fb5947e859d.png</url>
      <title>DEV Community: Sid Lohith</title>
      <link>https://dev.to/ranlohith</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ranlohith"/>
    <language>en</language>
    <item>
      <title>Java program to check palindrome string using recursion</title>
      <dc:creator>Sid Lohith</dc:creator>
      <pubDate>Thu, 29 Aug 2019 07:11:08 +0000</pubDate>
      <link>https://dev.to/ranlohith/java-program-to-check-palindrome-string-using-recursion-5edg</link>
      <guid>https://dev.to/ranlohith/java-program-to-check-palindrome-string-using-recursion-5edg</guid>
      <description>&lt;p&gt;How to check if a string is a palindrome in java using recursion in java is the most common java interview question.&lt;/p&gt;

&lt;p&gt;Recursion means a function calling itself. In this java program first “checkPalindrome()” method with String parameter “str” is created.&lt;/p&gt;

&lt;p&gt;This method first checks if user entered string length is 0 or 1 using if statement. Here, if string length is equal to 0 or 1 then string is palindrome.&lt;/p&gt;

&lt;p&gt;import java.util.Scanner;&lt;br&gt;
public class RecursivePalindromeJava &lt;br&gt;
{&lt;br&gt;
   public static boolean checkPalindrome(String str)&lt;br&gt;
   {&lt;br&gt;
      if(str.length() == 0 || str.length() == 1)&lt;br&gt;
         return true; &lt;br&gt;
      if(str.charAt(0) == str.charAt(str.length() - 1))&lt;br&gt;
         return checkPalindrome(str.substring(1, str.length() - 1));&lt;br&gt;
      return false;&lt;br&gt;
   }&lt;br&gt;
   public static void main(String[]args)&lt;br&gt;
   {&lt;br&gt;
      Scanner sc = new Scanner(System.in);&lt;br&gt;
      System.out.println("Please enter a string : ");&lt;br&gt;
      String strInput = sc.nextLine();&lt;br&gt;
      if(checkPalindrome(strInput))&lt;br&gt;
      {&lt;br&gt;
         System.out.println(strInput + " is palindrome");&lt;br&gt;
      }&lt;br&gt;
      else&lt;br&gt;
      {&lt;br&gt;
         System.out.println(strInput + " not a palindrome");&lt;br&gt;
      }&lt;br&gt;
      sc.close();&lt;br&gt;
   }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Please enter a string : mom&lt;br&gt;
mom is palindrome.&lt;/p&gt;

</description>
      <category>javaprograms</category>
      <category>palindromestring</category>
    </item>
  </channel>
</rss>
