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. Superb article
View Tutorial          By: Raj at 2015-01-29 11:18:22

2. 3. Write a program that will continuously ask for
View Tutorial          By: basil at 2011-08-04 13:00:30

3. This code worked but it only add the same vales se
View Tutorial          By: Dammy Temmy at 2013-01-17 17:22:17

4. how this program is work , please, tell
View Tutorial          By: rohit kumar at 2015-10-30 12:22:05

5. @Vaibhavn if you use an IP instead of a host name
View Tutorial          By: RDMA at 2011-01-04 14:30:15

6. thank you
i memorized it easly .

View Tutorial          By: kibrom at 2011-04-27 11:46:24

7. Like every other Java recursion example, this exam
View Tutorial          By: Uriah at 2010-05-08 18:59:16

8. Dear any buddy i use Nokia N73 and connect with Bl
View Tutorial          By: zstranger at 2012-03-29 07:43:12

9. very nice explanation of STATIC....HAY man , you j
View Tutorial          By: harkeet at 2012-12-18 17:48:43

10. simple way friends:
public class palindrome

View Tutorial          By: Manoj at 2013-01-07 02:18:00