Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class residence {
- String posision ;
- String username ;
- String pass ;
- String accNo ;
- String type ;
- String no ;
- public residence (String p ,String u ,String pas , String acc , String type , String no ){
- this.posision = p ;
- this.username = u ;
- this.pass = pas;
- this.accNo = acc;
- this.type = type ;
- this.no = no ;
- }
- public residence (){}
- }
- public class manager extends residence{
- public String posision ;
- public String username ;
- public String pass ;
- public String accNo ;
- public String type ;
- public String no ;
- public manager (){
- super();
- }
- public manager(String p ,String u ,String pas , String acc , String type , String no){
- super(p , u , pas, acc, type , no);
- }
- public String getUsername (){ return username; }
- }
- public static void main(String[] args) {
- File file = new File ("E:\guaz\eclipse_javafx\workspace\dkflozaTesting\src\dkflozaTesting\danial.txt");
- ArrayList<residence> building = new ArrayList<residence>();
- String posision ="";
- String username ="";
- String pass ="";
- String accNo = "" ;
- String type ="";
- String no = "";
- try{
- Scanner scan = new Scanner (file);
- while(scan.hasNext()){
- posision = scan.next();
- username= scan.next();
- pass = scan.next();
- accNo = scan.next();
- type= scan.next();
- no = scan.next();
- System.out.println(posision +" " + username +" "+ pass +" "+ type +" "+ no);
- if (posision.compareToIgnoreCase("m") == 0){
- System.out.println("in if : "+posision +" " + username +" "+ pass +" "+ type +" "+ no);
- manager mng = new manager(posision , username , pass , accNo , type , no );
- System.out.println("username : "+ mng.getUsername());
- building.add(mng);
- }
- }
- System.out.print("n n");
- //System.out.print(list.size());
- //System.out.print(list.get(0).getUsername());
- System.out.print("n n");
- }catch(Exception e){
- System.out.println(e.getLocalizedMessage());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement