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. Really clear and lucid explanation abt realloc ...
View Tutorial          By: metarus208 at 2012-01-01 14:25:25

2. Very good examples are given by you on overloading
View Tutorial          By: Ankur Rautela at 2011-11-03 10:22:46

3. but include<iostream> is main function.
View Tutorial          By: glen at 2009-02-03 22:19:22

4. hello can u send me the code in java to send and r
View Tutorial          By: somanath at 2011-02-17 01:28:40

5. Hi
Its nice example ..
som

View Tutorial          By: munirasu at 2011-04-01 06:38:46

6. Hi, thank you so much for this. I am going to give
View Tutorial          By: Eddie at 2011-02-21 14:10:04

7. it is really BEST answer of my question.
MR

View Tutorial          By: Ramesh genwa at 2010-09-09 07:15:37

8. explanation is good but i have one doubt what is t
View Tutorial          By: sulthan at 2012-10-09 06:13:14

9. thanks to this site which get me understand about
View Tutorial          By: Sayak at 2012-10-08 15:57:25

10. main is not needed for a simple program...

View Tutorial          By: manoj at 2012-05-29 17:46:08