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. so how can i run this project
View Tutorial          By: milinda at 2010-12-17 10:01:23

2. can any plz tell me how to create a calculator in
View Tutorial          By: sam at 2010-11-13 06:53:04

3. I am using VS2010 & SAP for crystal report. I
View Tutorial          By: Abdullah Al Mamun at 2011-08-11 23:20:37

4. great work..keep it up.
View Tutorial          By: faizaan at 2011-04-29 12:23:39

5. how can get ip url...?
View Tutorial          By: arjuna at 2011-11-23 03:31:46

6. in tc not accept argument directly run and gave fi
View Tutorial          By: vishal vekariya at 2012-11-16 11:06:38

7. Your page does not show the text in the proper col
View Tutorial          By: Warron at 2013-04-04 17:50:22

8. Ask to google.
View Tutorial          By: John at 2013-05-03 22:58:23

9. This article is clearly showing the beauty of the
View Tutorial          By: ashok at 2012-02-25 12:51:01

10. Sir. Please give an example which is small and und
View Tutorial          By: Rafik at 2011-08-17 19:45:04