Search
Submit & Win
Submit and win
Cash Prizes !
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Codes Author
Mon, 22-Dec-2014 Authors
Sheonarayan
40
All Time Authors
Satyapriyanayak
12160
Vishal@Neeraj
10880
Jayakumars
8120

Latest members | More ...


(Statistics delayed by 5 minutes)
 Codes

A simple program to check string palindrome in java

Abhisek
Posted by Abhisek under Others on 11/26/2009 1:00:56 AM | Views : 14003 | Status : [Member]

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="";
for(i=n-1;i>=0;i--)
str=str+s.charAt(i);
if(str.equals(s))
System.out.println(s+ "is palindrome");
else
System.out.println(s+ "is not a palindrome");
}
}


Abhisek Panda
Share this to:

Bookmark It

Comments or Responses


Login to post response