Comment on Tutorial - Palindrome String in Java By Grant Braught



Comment Added by : Aeron

Comment Added at : 2013-10-20 04:50:51

Comment on Tutorial : Palindrome String in Java By Grant Braught
this works
------------------------------------------

import java.util.Scanner;

public class PalindromeString {
static String str2 = "";
static String comString;
public static void main(String[] args) {
System.out.println("\n"+"enter the value");
Scanner s = new Scanner(System.in);
String enteredString = s.next();
comString = enteredString;
int stringLength = enteredString.length();
for (int i = stringLength - 1; i >= 0; i--) {
char currentChar = enteredString.charAt(i);
String str1 = Character.toString(currentChar);
str2 = str2.concat(str1);
}
if (str2.equals(comString)) {
System.out.println("Is Pallandrome");
} else {
System.out.println("Not a Pallandrome");
}
}
}


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. good its very useful to beginers
View Tutorial          By: venki at 2012-11-07 10:03:26

2. I wish to implement geocoding and reverse geocodin
View Tutorial          By: Leni at 2010-02-25 13:45:41

3. its simple and easy... good example.
View Tutorial          By: madhu kk at 2012-12-05 07:56:04

4. clearly explained the pgm logic....
thnx...

View Tutorial          By: Akshaya at 2011-11-24 04:12:36

5. Hello Nishi,
The class names in your progra

View Tutorial          By: Kiran at 2011-12-16 06:32:54

6. thanks sir for giving such basic knowledge of J2ME
View Tutorial          By: rahul aware at 2011-11-01 05:01:07

7. Hi everyone!
Pls I dnt know hot to configur

View Tutorial          By: DSE90 at 2010-02-12 12:05:57

8. Buenisimo, me ayuda a salir de un problema, cosas
View Tutorial          By: Emilio, Guatemala at 2012-09-25 15:33:11

9. yaar this example is easy to understand but other
View Tutorial          By: richa at 2009-09-08 13:52:37

10. gr8 work :)
View Tutorial          By: ahmad at 2011-03-23 01:05:57