Advertisement
Varasku

Biuro pliki elementowe próba

Jan 17th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1.  
  2. package biuro;
  3. import java.io.File;
  4. import java.io.FileNotFoundException;
  5. import java.util.Arrays;
  6. import java.util.Scanner;
  7. public class Biuro {
  8.  
  9.  
  10. public static void main(String[] args) throws FileNotFoundException {
  11. File file=new File("C:\\Users\\student\\Desktop\\biuro.txt");
  12. String text;
  13. try (Scanner in = new Scanner(file)) {
  14. text = in.useDelimiter("\\Z").nextLine();
  15. }
  16. System.out.println(text);
  17. System.out.println("________________\nDzielenie:\n");
  18.  
  19.  
  20. String[] biuro = text.split("-");
  21. System.out.println(Arrays.toString(biuro));
  22. String nazwa = biuro[0];
  23. String kond = biuro[1];
  24. String cena = biuro[2];
  25. String lokal = biuro[3];
  26.  
  27. int kond1 = Integer.parseInt(biuro[1]);
  28. int cena1 = Integer.parseInt(biuro[2]);
  29.  
  30.  
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement