Comment on Tutorial - Palindrome String in Java By Grant Braught
Comment Added by : Sandhya
Comment Added at : 2012-06-21 06:08:25
Comment on Tutorial : Palindrome String in Java By Grant Braught
The smiple easy and best way is :)
------------------------------------------------
import java.util.Scanner;
public class Palindrome {
static String str2 = "";
static String comString;
public static void main(String[] args) {
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
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
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
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program 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
Archived Comments
1. hi how ru
anybody tell me that how to print
View Tutorial By: imran at 2010-12-10 00:34:51
2. Nice explaination of constructor and destructor. B
View Tutorial By: Anon at 2009-03-01 03:50:06
3. can i ask a program that will compute a order from
View Tutorial By: mjae at 2011-09-12 08:02:46
4. good information
View Tutorial By: varun at 2013-01-04 14:51:19
5. This is very useful example for beginners.
View Tutorial By: Amresh at 2011-02-28 22:20:11
6. Very helpful!!
View Tutorial By: mahesh at 2012-07-12 06:24:50
7. finally i got it !!! thanks a lot!!! you really he
View Tutorial By: maher at 2010-11-11 02:44:07
8. I am new to this concept..It is really very useful
View Tutorial By: karthiga at 2013-01-02 11:20:38
9. Errm, Rails is just a bunch of Ruby scripts, not a
View Tutorial By: gngn at 2010-07-12 22:19:55
10. very good
View Tutorial By: pravin gajbhiye, nagpur at 2010-05-24 01:43:30