Answer to Question #237032 in Java | JSP | JSF for Selma Shigwedha

Question #237032
Create a program that when given a four word sentence as CMD arguments, it prints it backwards.
E.g the sentence “How are you Today”, will be printed as “Today you are How”.
Sample run 1: Sample run 2:
java lab02_task01 how are you today java lab02_task01 we are going home
Output: today you are how Output: home going are we
1
Expert's answer
2021-09-15T11:41:55-0400
public class Main {
	public static void main(String[] args) {
		if (args.length > 0) {
			for (int i = args.length - 1; i >= 0; i--) {
				System.out.print(args[i] + " ");
			}
		}
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS