Question: This exercises uses the String method toCharArray and a loop to display the letters in the string in reverse order. Write a simple program that

This exercises uses the String method toCharArray and a loop to display the letters in the string in reverse order.

Write a simple program that accepts a phrase as input and reverses the order of the letters and spaces in the phrase. Example Input The rain in Spain falls mainly on the Plain Example Output nialP eht no ylniam sllaf niapS ni niar ehT This may be a great place to use a for loop that decrements instead of increments. Like "for(int d = string.length() - 1; d >= 0; d--)"

What i have so far:

import java.util.*; /** * Date Created: * @author Student name * Filename: ReverseOrder.java */ public class ReverseOrder {

public static void main(String[] args) {

//******** Write your code here ********** } // end main } // end ReverseOrder class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!