| 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
1 comments so far (post your own) View All Comments Latest 10 Comments: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