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. HI . i got the following exception while start up
View Tutorial          By: Ramesh at 2011-02-01 00:14:14

2. Comment: yes i understood too:D:D perfect and brei
View Tutorial          By: eman at 2009-04-21 23:57:26

3. Thanks! Very helpful in creating a program i am tr
View Tutorial          By: BHaos at 2014-12-05 16:32:53

4. good for learners
View Tutorial          By: muhammed at 2012-11-20 10:38:28

5. Can anybody send me the java full code for sending
View Tutorial          By: David at 2010-08-22 22:57:38

6. I don't undrstnd.. cz I think in recurs the method
View Tutorial          By: Alina Ali at 2014-11-13 03:06:17

7. Please help here...
I tried both 0300460423

View Tutorial          By: Zafar Iqbal at 2013-04-02 20:14:29

8. Thanks a lot for this nice tutorial, it is very he
View Tutorial          By: Ted at 2014-02-07 12:50:24

9. send c++ programs on every topic of c++
View Tutorial          By: mandeep at 2009-07-11 00:50:23

10. Hi,
can anyone show or send me a sample pro

View Tutorial          By: jsn10 at 2011-09-14 05:41:03