Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package tam;
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FileReader;
- import java.util.ArrayList;
- /**
- *
- * @author Xuser
- */
- public class Nguoi {
- String cmt;
- String hoten;
- String diachi;
- String makhach;
- int loaikhach;
- public static Object readall()
- {
- ArrayList<Nguoi> a=new ArrayList<Nguoi>();
- File file=new File("NGUOI.INP");
- try (BufferedReader br = new BufferedReader(new FileReader(file))) {
- String line;
- int dem=0;
- while ((line = br.readLine()) != null) {
- Nguoi tam=new Nguoi();
- int dung=1;
- tam.cmt=line;
- if(line=="")
- dung=0;
- for(int i=1;i<3;i++)
- {
- line = br.readLine();
- if(line==null||line=="")
- dung=0;
- tam.hoten=line;
- line = br.readLine();
- if(line==null||line=="")
- dung=0;
- tam.diachi=line;
- }
- if(dung==1)
- a.add(tam);
- }
- }catch(Exception e)
- {
- }
- return a;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement