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



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 need full program for connect oracle to struts l
View Tutorial          By: Munaver Basha at 2010-09-30 01:28:10

2. Thank you, you save my day!!
View Tutorial          By: jano at 2011-05-26 17:20:47

3. public void playSound(String filename) {

View Tutorial          By: Rowan at 2014-07-17 10:26:02

4. not work
View Tutorial          By: kkbb at 2011-03-12 03:52:06

5. Great Article! Thanks
View Tutorial          By: Rachid at 2011-06-21 13:01:39

6. hi Ashray P Shetty,
I want assistance in th

View Tutorial          By: Shabbir Manasawala at 2010-11-19 02:02:43

7. Thankyou very much for the explanation
View Tutorial          By: Ruchita at 2010-11-11 01:16:10

8. can anybody tell me the full code for sending sms
View Tutorial          By: shikha at 2008-10-13 11:43:40

9. cool.
View Tutorial          By: Fahad Palomo at 2011-08-03 06:19:56

10. i want to know about java related topic in simple
View Tutorial          By: saurav at 2010-04-29 04:39:55