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. Very good article on string , please also mentions
View Tutorial          By: Subham at 2014-04-29 18:01:04

2. hi MR. A.Balaji
can u help me how you have

View Tutorial          By: mjnanthini at 2010-10-03 23:04:35

3. error is main fuuction declaration
void mai

View Tutorial          By: T.M.Prakash.MCA. at 2012-09-20 12:26:52

4. What is AWS?
View Tutorial          By: Toja at 2013-01-22 10:36:45

5. Hi,

How to implement this 5 files i

View Tutorial          By: Yanosh at 2009-07-16 06:00:14

6. nice tutorial man !
View Tutorial          By: yash at 2012-11-10 05:08:31

7. hi,
i need to connect to server named xxx,i

View Tutorial          By: annamalai at 2012-05-21 10:09:52

8. I want de total main prg to send and receive... se
View Tutorial          By: sharu at 2011-09-12 16:49:24

9. Thanks ...it is really nice .superb site to learn
View Tutorial          By: hari at 2012-12-12 07:41:16

10. This works great, just remember to add <uses-pe
View Tutorial          By: Nick at 2012-06-20 07:37:15