| 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 | ||||
|
||||
|
|
||||
| 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
|
|
||||||||||||||||||||||||||||||
|
Home | JSP | EJB | JDBC | Java Servlets | WAP | Free JSP Hosting | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs |
||||||||||||||||||||||||||||||
Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.
Copyright © 2007. All rights reserved.
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