Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML
 
 
Hot Web Programming Job

 

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Java Tutorials

Core Java
JSP
Servlet
JDBC
Hibernate
Struts 1
Struts 2
JSF
Spring
J2EE
J2ME
Web Services
Ajax
Dojo
MySQL
Latest Comments
Null pointer excep
swap program faile
hi.........
very good
navigaton mobile
  All Comments...
 

 

 
Struts Tutorials
*Stuts TOC
*Apache Struts Introduction
* Struts Controller
* Struts Action Class
* Struts ActionFrom Class
* Using Struts HTML Tags
*Struts Validator Framework    
*Client Side Address Validation    
*Struts Tiles
*tiles-defs.xml
*Struts DynaActionForm
*Struts File Upload
*Struts DataSource
*AGGREGATING ACTIONS
*Internationalization
Struts Resources
*Struts Books
*Struts Articles
*Struts Frameworks
*Struts IDE
*Struts Alternative
*Struts Links
*Struts Presentations
*Struts Projects
*Struts Software
*Struts Reference
*Struts Resources
*Other Struts Tutorial
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Java Beginners Palindrome

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

9 comments so far (post your own) View All Comments Latest 10 Comments:

for the java palindrome example shown in the yellow box at the top, how do you make it so, once it reverses the number once, you add the reversed number with its original number, and if that sum is still not a palindrome, how do you reverse that sum again?

Posted by heyhey on Friday, 05.30.08 @ 01:59am | #61377

i am very thankful to you because you give me a necessary program for examination

Posted by arun ranawat on Sunday, 03.23.08 @ 22:37pm | #53969

that my code....pleese i need help in my while and do....

import apcslib.*;
import chn.util.*;

public class Palindrome
{
String sentence;
String reverse;

public Palindrome ()
{
sentence ="";
reverse ="";
}
public void start()
{
getInput ();
reverseInput ();
compareSens ();
}
public void getInput()
{
System.out.println("Welcome To PALINDROME");
ConsoleIO console = new ConsoleIO();
System.out.print("Please enter your sentence ");
sentence = console.readLine();
sentence = sentence.toLowerCase();
System.out.println("Your sentence is " + sentence);
}

public void reverseInput ()
{
String temp = sentence.trim();
System.out.println("Your trim sentence is "+ temp);
int senLength=temp.length();
System.out.println("Length of the sentence is "+ senLength);
int n = temp.indexOf(" ");
System.out.println("The first white space is at "+n);
while (senLength>0)
{
temp=temp=temp.substring(0,n);
temp=temp.substring(n+1,temp.length());
System.out.println("The second white space is at " + temp);
reverse=reverse+sentence.charAt(senLength-1);
senLength--;
}
System.out.println("The reverse is " + reverse);
}
public void compareSens ()
{
if (sentence.equals(reverse))
System.out.println("The sentence is a palindrome");
else
System.out.println("The sentence is not a palindrome");
}
}

Posted by saima on Thursday, 02.21.08 @ 06:52am | #49269

i need help of my prg in palindrome
class Palindrome
{
public static void main(String[] args) throws IOException
{
String str[]=new String[1];
String dest[]=new String[1];
int j=0;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the String to Palindrome");
int i=str.length;
for(i=(i-1);i>=0;i--)
{
str[i]=br.readLine();
dest[j]=str[i];
j++;
}
//if(dest.compareTo(str)==0)
if(str.equals(dest))
{
System.out.println("String are Palindroome");
}
else
{
System.out.println("not palindrome");
}
}
}

plz correct the program
thanks in adv

Posted by Siva on Tuesday, 02.12.08 @ 19:23pm | #48041

your for-loop is astonishing...
do you realize what are you doing there?

Posted by afasias on Thursday, 01.17.08 @ 14:48pm | #45431

Why we are using Integer.parseInt()method

Posted by Rashmi on Tuesday, 11.6.07 @ 11:09am | #35869

Would it not be easier to store the line input into a string, then parsing the string into an integer, then parsing the reversed string into a separate integer variable and comparing them?

Posted by Miguel on Monday, 10.8.07 @ 10:13am | #32437

Java Program for palindrome

Posted by Dhanush on Sunday, 08.5.07 @ 14:51pm | #22705

I tried to run this code but it won't work on zeros.. it converts the zeros to one....

Posted by ~javaness~ on Tuesday, 05.8.07 @ 08:13am | #15435

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Back to Tutorial

 

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.