Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Powtorzenie
  4. {
  5.  
  6. public static void main(String[] args)
  7. {
  8. // klase pies, tablice psow przeczytqaj dane z pliku do tej tablicy psow, wyswietl
  9. int[] tablicaPsow = new int [0];
  10. //List<> listaPsow = new ArrayList()<>;
  11. Pies.doPliku();
  12. }
  13.  
  14.  
  15. public class Pies
  16. {
  17. Sting imie;
  18. int wiek;
  19. double waga;
  20. Pies(String aImie, int aWiek, double aWaga)
  21. {
  22. imie = aImie;
  23. wiek = aWiek;
  24. waga = aWaga;
  25. }
  26.  
  27. public void doPliku()
  28. {
  29. try
  30. {
  31.  
  32. File f = new File("psy.txt");
  33. Scanner s = new Scanner(f);
  34.  
  35. int[] psy = new int [0];
  36. int x;
  37.  
  38. while(s.hasNext())
  39. {
  40. psy.add(s.next());
  41. }
  42.  
  43. }
  44. catch(IOException e)
  45. {
  46. System.out.println("Blad: "+e.toString());
  47. }
  48.  
  49. System.out.println(Arrays.toString(psy));
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement