.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Code Snippets >> OOPS >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

A simple program to check string palindrome in java

Posted By:Abhisek Panda       Posted Date: November 26, 2009    Points: 10    Category: OOPS    URL: http://www.dotnetspark.com  

        This code uses a for loop to reverse a string not the reverse() method of Java. Then it compares the reversed string with the actual string using equals() method.

Class Palindrome
public static void main(String args[])
String s="malayalam";
int i;
int n=s.length();
String str="";
System.out.println(s+ "is palindrome");
System.out.println(s+ "is not a palindrome");


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend