Advertisement
Svetlana_Ovsjanikova

java - Lists.examples

Sep 21st, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package day5_lists;
  7.  
  8. import java.util.ArrayList;
  9.  
  10. /**
  11. *
  12. * @author sao_7
  13. */
  14. public class ListExamples {
  15.  
  16. public static void sampleList(){
  17. ArrayList<Integer> sample = new ArrayList<Integer>();
  18.  
  19. sample.add(4); //pievienojam tris vertibas
  20. sample.add(1);
  21. sample.add(6);
  22.  
  23. for (int i = 0; i < sample.size(); i++) { //izvadam tas vertibas
  24. System.out.println(sample.get(i));
  25. }
  26.  
  27.  
  28. }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement