×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Clifton Foster
Added: Jun 1, 2016 1:17 AM
Modified: Jun 1, 2016 1:19 AM
Views: 14
Tags: fo list while
  1.         for (int i = 3; i <= 30; i = i + 3) {
  2.      
  3.                 System.out.println(i);
  4.      
  5.         }
  6.  
  7.         int x = 1;
  8.         int triangularNumber = 1;
  9.    
  10.         while (x <= 10) {
  11.      
  12.                 System.out.println(triangularNumber);
  13.      
  14.                 x++;
  15.        
  16.                 triangularNumber = triangularNumber + x;
  17.      
  18.         }
  19.      
  20.         List<String> familyMembers = new ArrayList<String>();
  21.        
  22.         familyMembers.add("Rob");
  23.         familyMembers.add("Kirsten");
  24.         familyMembers.add("Tommy");
  25.         familyMembers.add("Ralphie");
  26.        
  27.         for (String name : familyMembers) {
  28.        
  29.                 System.out.println(name);
  30.        
  31.         }