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. Please assist me in getting the code to read messa
View Tutorial          By: Jaydatta at 2009-04-05 23:24:57

2. thanks alot steven for the code. i'm try to automa
View Tutorial          By: Roger at 2011-05-17 17:33:07

3. hi purushothaman
thanks for your kind resp

View Tutorial          By: sandeep das at 2009-04-11 10:42:58

4. how i can used inheritence ?
View Tutorial          By: samee at 2008-02-16 12:54:27

5. very good
View Tutorial          By: amit at 2009-10-24 01:55:26

6. i'm interest in j2me so i have to learn about j2me
View Tutorial          By: cha at 2013-10-14 13:17:22

7. what is the use of int getch(void)
and unge

View Tutorial          By: sania at 2014-06-04 17:15:30

8. Use (JavaScript) below code to display client dat
View Tutorial          By: pmprash at 2009-12-22 01:15:33

9. nice example's
View Tutorial          By: karthi at 2011-01-30 02:25:36

10. Managing several submissions can be a lot more sim
View Tutorial          By: Curran Cline at 2012-12-18 05:43:44