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. Sir, I need to use MS Access as a database in java
View Tutorial          By: John Moses at 2012-03-31 00:20:38

2. Very good. Excellent examples and easy to understa
View Tutorial          By: Fernando Basso at 2012-09-30 22:17:56

3. Thanks bro...you save me from a great problem...ve
View Tutorial          By: Tishan at 2012-07-09 09:14:07

4. Fantastic Post, can u pls tell me how can i pass q
View Tutorial          By: Kunal at 2012-08-07 07:02:41

5. Im using maxis broadband now.
I want to cre

View Tutorial          By: rayminn at 2012-06-03 21:08:13

6. thank you sir
View Tutorial          By: sivaranjani at 2015-01-30 01:15:40

7. Great details you provided here, very straight for
View Tutorial          By: Jackie Wong at 2010-02-05 10:52:25

8. good example tnq...........
View Tutorial          By: SaidiReddy at 2012-06-09 12:03:09

9. Hi sir,
please send some sample code for sp

View Tutorial          By: hindu at 2013-03-21 06:00:09

10. hey thats a superb way of explaining in plain term
View Tutorial          By: Agastya at 2011-05-08 03:11:53