Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1.  
  2. public class Demo {
  3.  
  4.     private static String[] footballPlayers = {"Brady", "Rodgers", "Favre", "Gordon", "OBJ"};
  5.  
  6.  
  7.     // Main
  8.     public static void main(String[] args){
  9.  
  10.         // print names of football players
  11.         System.out.println(footballPlayers[0]);
  12.         System.out.println(footballPlayers[1]);
  13.         System.out.println(footballPlayers[2]);
  14.         System.out.println(footballPlayers[3]);
  15.         System.out.println();
  16.        
  17.         // using a for loop    
  18.         // Until player index is < 5
  19.         for (int playerIndex=0; playerIndex < footballPlayers.length; playerIndex++){
  20.             System.out.println(footballPlayers[playerIndex]);
  21.         }
  22.  
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement