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. Basic Example to undestand java literal persons
View Tutorial          By: Sajid mestri (maha,sangli) at 2010-10-30 00:44:44

2. I need to creat class. Write in class void named r
View Tutorial          By: Aliarth at 2012-11-18 00:03:15

3. FYI, if you're using NetBeans, the input file shou
View Tutorial          By: pberg at 2013-03-28 17:00:16

4. this site is good, can anyone plz suggest me how t
View Tutorial          By: Prithvi at 2008-08-27 01:09:56

5. good explanation,
Thanks

View Tutorial          By: venkatesh at 2012-01-04 08:43:48

6. Thanks for good atricle. But this code will always
View Tutorial          By: Binod Suman at 2009-05-28 09:40:48

7. Can you send me the file please?
[email protected]

View Tutorial          By: laue at 2014-11-18 20:35:02

8. Hi
Can u plz tell me how to implement this

View Tutorial          By: Rohan at 2008-09-23 05:52:31

9. How to connect a webpage(which I have created for
View Tutorial          By: sam at 2012-01-24 10:10:52

10. i want jsp code
View Tutorial          By: KIRTHANA at 2015-07-31 05:29:04