Advertisement
letsdoitjava

First Names

Jul 14th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. // Storing Names in a string array and then printing them in reverse order.
  2. // Renee Waggoner
  3. // July 17, 2019
  4. // Special Requirements: None
  5.  
  6. package string_array;
  7.  
  8. public class FirstNames {
  9.  
  10.     public static void main(String[] args) {
  11.         // storing names in array
  12.         String firstNames[] = new String[]{"George", "Fred", "Sam", "Mary", "Sarah", "Bella", "Joy", "Rita", "Marta", "Sue", "Nancy"};
  13.  
  14.         //prints in reverse order
  15.         for(int i = firstNames.length - 1 ; i >= 0 ; i--){
  16.             System.out.println(firstNames[i]);
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement