Java
How to create reverse loop in java count by five...
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Roei BarRank #1,271 · 1.4K reputationPosted Sep 13, 2009, 6:13 AM EDT
public class Reverse { public static void main(String[] args) { // Loop backwards through the array of arguments for(int i = args.length-1; i >= 0; i--) { // Loop backwards through the characters in each argument for(int j=args[i].length()-1; j>=0; j--) { // Print out character j of argument i. System.out.print(args[i].charAt(j)); } System.out.print(" "); // Add a space at the end of each argument. } System.out.println(); // And terminate the line when we're done. } }ravi dahiya22 reputationPosted Sep 14, 2009, 4:47 AM EDT