Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Powtorzenie
- {
- public static void main(String[] args)
- {
- // klase pies, tablice psow przeczytqaj dane z pliku do tej tablicy psow, wyswietl
- int[] tablicaPsow = new int [0];
- //List<> listaPsow = new ArrayList()<>;
- Pies.doPliku();
- }
- public class Pies
- {
- Sting imie;
- int wiek;
- double waga;
- Pies(String aImie, int aWiek, double aWaga)
- {
- imie = aImie;
- wiek = aWiek;
- waga = aWaga;
- }
- public void doPliku()
- {
- try
- {
- File f = new File("psy.txt");
- Scanner s = new Scanner(f);
- int[] psy = new int [0];
- int x;
- while(s.hasNext())
- {
- psy.add(s.next());
- }
- }
- catch(IOException e)
- {
- System.out.println("Blad: "+e.toString());
- }
- System.out.println(Arrays.toString(psy));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement