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. Thanks for this great tutorial... was looking for
View Tutorial          By: Shashi at 2012-09-20 11:35:08

2. You should show how to implement a custom sorting
View Tutorial          By: AngleWyrm at 2012-12-13 19:35:30

3. Its working ,,, gud stuff.
View Tutorial          By: Atul at 2011-07-21 10:34:44

4. Hei Kaify What is this????
if we get knowle

View Tutorial          By: Sooraj A.S at 2011-08-26 14:12:36

5. It is very helpful, I searched in many websites, b
View Tutorial          By: Anil Vaja at 2013-10-14 17:21:42

6. I am getting a blank page. Closed the table tag an
View Tutorial          By: Harshal at 2013-02-19 14:56:35

7. hope this may help u

class product<

View Tutorial          By: princess at 2011-11-30 12:11:57

8. In the above example..where you make the GC1 objec
View Tutorial          By: prasad at 2014-12-11 11:12:28

9. This says nothing meaningful.

So ho

View Tutorial          By: Andreas at 2012-09-23 23:01:01

10. how to use isset keyword with multidimensional arr
View Tutorial          By: mehul at 2015-01-19 23:47:02