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. I have copied c:\php\bin\msvcr80.dll to C:\Program
View Tutorial          By: agt at 2009-10-11 09:24:06

2. so what about, if i need to remove these letters f
View Tutorial          By: need Help at 2009-11-12 08:40:31

3. Wow thx, this is really easy for me to understand
View Tutorial          By: brian at 2010-03-22 05:15:47

4. The code gives the following exception :-
<

View Tutorial          By: waqar at 2012-07-26 17:02:07

5. Thanks!
View Tutorial          By: misterTi at 2015-03-18 17:48:41

6. super
View Tutorial          By: asasdfsa at 2014-05-29 05:23:04

7. i get this error too.
: Parent: child proce

View Tutorial          By: Anon at 2009-02-25 08:30:58

8. I discover unlimited calendar.this calendar use of
View Tutorial          By: Lalit Kumbhani at 2011-12-31 16:02:06

9. Hi guys, What is the best way to connect to mysql
View Tutorial          By: veron at 2010-09-11 16:13:25

10. Its really good and helpfull..........
chee

View Tutorial          By: sumit at 2009-04-28 05:17:17