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. hai
i can run this program bt 1 exception

View Tutorial          By: Raheela at 2010-05-25 21:59:38

2. please give some examples of postfix and infix.
View Tutorial          By: john mark at 2012-10-07 13:55:04

3. Hello
I installed Android in eclipse...only

View Tutorial          By: amit kumar at 2012-01-19 11:04:55

4. nice
View Tutorial          By: utkarsh at 2015-03-10 03:18:26

5. can i use comma operator in simbolic constant in c
View Tutorial          By: Madheswaran at 2011-12-05 18:44:22

6. Hi, this blog answers my questions but what is the
View Tutorial          By: Edu at 2009-09-20 00:19:27

7. Explanation was good and easily comprehendable.
View Tutorial          By: Moin Adil at 2009-06-17 04:18:56

8. tis s very useful and easy to capture all persons
View Tutorial          By: Divya at 2013-12-19 05:42:32

9. Awesome post....
View Tutorial          By: Zeeshan Ali Ansari at 2012-11-24 06:35:20

10. Good example...easy to read and understand...
View Tutorial          By: Codventure at 2009-09-11 00:07:06