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. Simple and easy code..........
View Tutorial          By: mandalson at 2011-12-24 06:50:38

2. very simple and nice examples for begineer...
View Tutorial          By: sarhand at 2010-04-21 00:57:23

3. Thanks , really appreciate
View Tutorial          By: Marlen at 2010-11-23 10:50:29

4. Easy and Wonderfulimple Example...to undersatnd th
View Tutorial          By: Chaitanya at 2010-04-04 02:27:04

5. This is awesum !!!
easy to understand ....

View Tutorial          By: Sud at 2011-01-19 08:37:55

6. Hi,.
No Change yaar, Im still getting the s

View Tutorial          By: Dinesh Rajendiran at 2012-03-23 05:19:06

7. Please don't use DataInputStream to read text. Unf
View Tutorial          By: Peter Lawrey at 2013-01-30 23:46:47

8. can you provide the full class from start to begin
View Tutorial          By: mohit at 2011-12-01 09:56:22

9. Great explanations! I looked for other guides and
View Tutorial          By: A.Lepe at 2010-09-15 21:36:42

10. Hi Guys, thanks for sharing this... I have some mo
View Tutorial          By: Fins at 2011-12-14 04:40:09