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



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. Hiii....i am using windows 8..jdk1.7.51 and netbea
View Tutorial          By: Pravin Kamble at 2014-05-03 07:00:12

2. I am using MacOSX 10.5.4 and only enabling the mod
View Tutorial          By: Sachin at 2011-03-26 00:23:05

3. thanks f0r this p0st... it heLped me much... keep
View Tutorial          By: martz at 2009-04-29 02:27:19

4. i want simple program of function used in recursio
View Tutorial          By: manish at 2009-05-19 01:03:19

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

6. you can put the a loop for multiple extension
View Tutorial          By: Arun at 2012-12-07 05:23:47

7. Great article! Simple and precise. Thanks!
View Tutorial          By: dz at 2014-10-06 04:36:56

8. Thanks a lot for this great post.
View Tutorial          By: Ram Para at 2012-03-23 17:07:09

9. HI EVERY ONE I AM NEW IN J2ME SO I WANT TO LEARN S
View Tutorial          By: KALAI at 2011-04-04 03:10:32

10. Works great! Thanks!
View Tutorial          By: Ewa at 2013-06-19 10:52:07