Advertisement
virtualideaz

For-Each/Enhanced For loop example

Oct 22nd, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.34 KB | None | 0 0
  1. //
  2. //this is a repitition statement
  3. //
  4. public class RepititionStatements {
  5.     public static void main(String [] args) {
  6.         //this is a enhanced for loop example
  7.        
  8.         int [] intArray = new int[] {1,2,3,4,5,6};
  9.        
  10.         for (int a : intArray)
  11.         {
  12.             System.out.println(a + " ");
  13.         }
  14.     }
  15. }
  16.  
  17. --copy until here--
  18.  
  19. OUTPUT:
  20.  
  21. 1
  22. 2
  23. 3
  24. 4
  25. 5
  26. 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement