Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1.     {
  2.         RandomAccessFile raf = null;
  3.         String[] split;
  4.         String s = "";
  5.         String imie = "";
  6.         String nazwisko = "";
  7.         int wiek = 0;
  8.        
  9.         try
  10.         {
  11.             raf = new RandomAccessFile(plik,"rw");
  12.            
  13.             while(raf.getFilePointer() < raf.length())
  14.             {
  15.                 s = raf.readLine();
  16.                 split = s.split("-");
  17.                
  18.                 for (int i = 0 ; i < split.length; i++)
  19.                 {
  20.                     imie = split[0];
  21.                     nazwisko = split[1];
  22.                     //wiek = str[2];
  23.                 }
  24.                 System.out.println("Imie = "+ imie +", Nazwisko = "+ nazwisko +", Ma "+ wiek +" lat");
  25.             }
  26.            
  27.         }
  28.         catch(IOException e){System.out.println("Niedziala");}
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement