Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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: A kciuq nworb xof spmuj revo eht yzal rotagilla"); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started