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. Very usefull tutorial, but I've got a question:
View Tutorial          By: Wolfgang Marcos at 2011-05-16 11:12:19

2. pls tell me how to insert data in database .
View Tutorial          By: sankar at 2009-10-22 05:37:45

3. How can i add text under this all images
View Tutorial          By: jana at 2013-07-09 04:32:38

4. hi..i can send 4 or 5 sms per mnt..is there any wa
View Tutorial          By: rahul at 2011-02-11 00:17:51

5. Nice example to understand what does the string T
View Tutorial          By: vikash from india at 2011-06-23 06:39:03

6. how to run this program? give sample code to cre
View Tutorial          By: meena at 2012-01-12 11:52:03

7. Thank you so much for this. This helped me through
View Tutorial          By: GeeAsphyxiated at 2009-08-31 08:03:07

8. This is just the web service, if you want to consu
View Tutorial          By: Carlos Kassab at 2015-02-20 17:18:06

9. This Example program is very useful.
good w

View Tutorial          By: sathya at 2008-03-28 02:21:41

10. Hi, i am newly in java,please send me on sample pr
View Tutorial          By: aruna.k at 2012-12-13 06:05:44