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. what's the deffrint between "String[] [] Arra
View Tutorial          By: ahmad at 2009-08-24 03:01:11

2. I wont to know about every thing of java
View Tutorial          By: susantha at 2009-10-11 09:35:40

3. "This happens immediately, and before any oth
View Tutorial          By: David at 2007-10-02 06:52:20

4. Hallo every one. I am working on my project in j2m
View Tutorial          By: radhe at 2010-12-14 08:08:25

5. Thanks to you for providing such a wonderful infor
View Tutorial          By: Tara Patra at 2010-08-30 07:22:44

6. I need Structs full notes with examples
View Tutorial          By: Thomas at 2012-10-24 11:18:11

7. a pretty good site for learners
View Tutorial          By: chaitra at 2011-12-15 10:09:14

8. This is by far the easiest way I have yet seem, ma
View Tutorial          By: doahh at 2010-03-08 11:23:48

9. teacher namin na si Engr. Lumasag nakakasira ng ba
View Tutorial          By: rossy at 2011-10-06 06:12:53

10. How can you print this using recursion?

View Tutorial          By: Menon at 2011-09-08 07:16:02