/*Programmer: Jeanne Ramos
Program Name: Word Reverser
Date Started: March 23, 2009
Date Ended: March 24, 2009
Program Purpose: A program that will ask a String to the user,then the program will read it and
print it in a reverse form.*/
import java.util.*;
public class reverseword{
public static void main(String args[])
{
String inputword;
String word;
Scanner scan=new Scanner(System.in);
System.out.println("Enter a sentence:");
input=scan.nextLine();
StringTokenizer st=new StringTokenizer(wordinput) ;
while (st.hasMoreTokens())
{
word=st.nextToken();
word=new StringBuffer(r).reverse().toString();
System.out.println(word+" ");
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment