import java.util.Scanner; // Use a scanner and read each word from a string containing multiple words. Print
Question:
import java.util.Scanner;
// Use a scanner and read each word from a string containing multiple words. Print each word in reverse order
public class ReverseWord
{
public static void main(String[] args)
{
String words = "A quick brown fox jumps over the lazy alligator";
Scanner in = new Scanner(words);
while (in.hasNext())
{
String word = in.next();
//-----------Start below here. To do: approximate lines of code = 2
// You must use a for loop and the charAt() method of class String to print the characters of the word in reverse order
// Hint: count down rather than up
//-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions.
System.out.println("");
}
System.out.println("Expected: Akciuqnworbxofspmujrevoehtyzalrotagilla");
}
}
Business Communication
ISBN: 978-1439080153
8th edition
Authors: Buddy Krizan, Patricia Merrier, Joyce P. Logan, Karen Schneiter Williams