Comment on Tutorial - Palindrome String in Java By Grant Braught



Comment Added by : Bhaskar.pg

Comment Added at : 2014-05-29 12:39:52

Comment on Tutorial : Palindrome String in Java By Grant Braught
import java.util.*;

class Pstring
{
public static void main(String args[])
{
String original, reverse="";
Scanner in = new Scanner(System.in);

System.out.println("Enter a string to check if it is a palindrome");
original = in.nextLine();

int length = original.length();

for ( int i = length - 1 ; i >= 0 ; i-- )
reverse = reverse + original.charAt(i);

if (original.equals(reverse))
System.out.println("Entered string is a palindrome.");
else
System.out.println("Entered string is not a palindrome.");

}
}


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. thanq for this tutorial. It is very useful. But i'
View Tutorial          By: syahmi at 2010-03-06 02:55:05

2.
View Tutorial          By: pmprash at 2009-12-22 01:15:33

3. hi,

i have a problem. I have the ti

View Tutorial          By: Felipe at 2010-02-18 05:03:51

4. The code gives the following exception :-
<

View Tutorial          By: Lourdu Felix at 2009-01-26 03:37:53

5. Respected Sir,
We are

View Tutorial          By: Core Java at 2009-10-24 01:36:20

6. Yes the article is good and useful...!
View Tutorial          By: Regalla Naresh Reddy at 2009-04-12 23:16:24

7. Yeah..it's very good example....
View Tutorial          By: Packiyaraj.T at 2010-07-22 22:39:48

8. nice information, thanks dost.
View Tutorial          By: Bhargavi Menpara at 2013-02-12 08:11:23

9. I am using my NOKIA 2700 classic via blutooth conn
View Tutorial          By: Raheela at 2010-05-06 03:11:36

10. Hi All,

Can any one please let me k

View Tutorial          By: Deepak at 2015-03-19 15:24:40