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. realy i enjoy it for visit your site. and i unders
View Tutorial          By: vinod balot at 2015-02-09 17:43:30

2. hi
i try to write a code for send data or s

View Tutorial          By: mjh at 2011-02-16 08:26:10

3. Quite Helpful.....
^_^

View Tutorial          By: Alfred_Septio at 2012-09-26 12:38:47

4. Please add the code snippet ..
View Tutorial          By: mari selvam at 2012-08-23 10:13:51

5. Hii.... We are B.Tech 4th year students. We are wo
View Tutorial          By: Shipra Malik at 2010-08-17 03:32:34

6. dear i have different files of ms access 2010 like
View Tutorial          By: neeo at 2012-01-16 07:02:20

7. It is throwing exception....Image is not displayin
View Tutorial          By: Aswin at 2012-02-12 08:07:41

8. I'm coding a webservice and this is exactly what I
View Tutorial          By: Cristian at 2014-11-14 12:52:34

9. pl send me how to download java 2 micro edition do
View Tutorial          By: Narayana at 2013-02-21 10:08:27

10. it's really Nice Clock
View Tutorial          By: Mido at 2007-09-09 08:45:49