List of all available Websheets
Viewing java/03-arrays/Reverse by daveagp@gmail.com. You have unsaved changes. Log in above to create, edit, preview and publish Websheets.
Property | Value |
---|---|
Description html markup shown to student | Write a program <code>Reverse</code> that takes any number of command-line arguments and prints them out on a single line in reverse order. For example, <code>java Reverse these words will be reversed</code> should output <pre>reversed be will words these</pre> For simplicity, add spaces after each word, including the last one. |
Public permissions | |
Engine | |
Template / Reference solution | public static void main(String[] args) { \[ for (int i=args.length-1; i>=0; i--) System.out.print(args[i]+" "); ]\ } |
Java test suite See manual | testMain("reversed", "be", "will", "words", "these"); testMain("arrays", "are", "awesome"); testMain("The", "structure", "of", "a", "sentence", "is", "not", "symmetric"); testMain("one-word"); testMain(); |
Solution visibility |
Note: problems are open-source by default (see 'Public permissions'). Assumed license for open problems is Creative Commons 4.0 Attribution-ShareAlike unless specified in 'Remarks'.