Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. import java.util.Arrays;
  2. import java.util.List;
  3.  
  4. public class Main {
  5.  
  6.     public static void main(String... args) {
  7.  
  8.         List<String> listaSlow = Arrays.asList("Pierwsze", "Drugie", "Trzecie");
  9.  
  10.         System.out.println("Pętla for each:");
  11.        
  12.         for(String wartoscZListy : listaSlow) {
  13.             System.out.println("Wypisuję z for eacha: " + wartoscZListy);
  14.         }
  15.  
  16.         System.out.println("Zwykla petla: ");
  17.  
  18.         for(int i = 0; i < listaSlow.size(); i++) {
  19.             System.out.println("Wypisuje z for-a: " + listaSlow.get(i));
  20.         }
  21.     }
  22.    
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement