Advertisement
Guest User

Untitled

a guest
Nov 1st, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 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 tam;
  7.  
  8. import java.io.BufferedReader;
  9. import java.io.File;
  10. import java.io.FileReader;
  11. import java.util.ArrayList;
  12.  
  13. /**
  14. *
  15. * @author Xuser
  16. */
  17. public class Nguoi {
  18. String cmt;
  19. String hoten;
  20. String diachi;
  21. String makhach;
  22. int loaikhach;
  23. public static Object readall()
  24. {
  25. ArrayList<Nguoi> a=new ArrayList<Nguoi>();
  26. File file=new File("NGUOI.INP");
  27. try (BufferedReader br = new BufferedReader(new FileReader(file))) {
  28. String line;
  29. int dem=0;
  30. while ((line = br.readLine()) != null) {
  31. Nguoi tam=new Nguoi();
  32. int dung=1;
  33. tam.cmt=line;
  34. if(line=="")
  35. dung=0;
  36. for(int i=1;i<3;i++)
  37. {
  38. line = br.readLine();
  39. if(line==null||line=="")
  40. dung=0;
  41. tam.hoten=line;
  42. line = br.readLine();
  43. if(line==null||line=="")
  44. dung=0;
  45. tam.diachi=line;
  46. }
  47. if(dung==1)
  48. a.add(tam);
  49. }
  50. }catch(Exception e)
  51. {
  52.  
  53. }
  54. return a;
  55. }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement