Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. package string_array;
  2.  
  3. /**
  4.  * String array problem
  5.  *
  6.  */
  7. public class Main {
  8.  
  9.     /**
  10.      * Entry point
  11.      * @param args command line args
  12.      */
  13.     public static void main(String[] args) {
  14.         String[] firstNames = {"George", "Fred", "Sam", "Mary", "Sarah", "Bella", "Joy", "Rita", "Marta", "Sue", "Nancy"};
  15.         //print the names backwards
  16.         for(int i = firstNames.length - 1; i >=0; --i) {
  17.             System.out.print(firstNames[i] + " ");
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement