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



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. Very good explanation . i understood easily
View Tutorial          By: whyte at 2014-03-25 10:12:00

2. Hi,
Even if the while loops (in Producer an

View Tutorial          By: Pranay at 2012-09-19 19:08:45

3. Very good explanation specially overlapped memory
View Tutorial          By: MANISH RASTOGI at 2010-06-22 05:44:07

4. help me in my final project about arrays
View Tutorial          By: grace at 2013-03-13 09:54:11

5. You may add STAX parser example also to complete t
View Tutorial          By: Satyam Jaiswal at 2014-11-25 05:48:59

6. it should be:
/* --------------- */

View Tutorial          By: Ryba at 2010-05-19 15:45:48

7. Nice one.your example proves that if you are apply
View Tutorial          By: Nisarg pathak at 2015-09-30 17:23:37

8. Very helpful.
View Tutorial          By: Krishna at 2012-06-14 10:25:00

9. Thanks for the solution. I must say however that t
View Tutorial          By: Pierre at 2009-11-19 20:16:35

10. i want to know about basic requirement for jdbc ,
View Tutorial          By: Amit sharma at 2009-03-19 04:10:24