I have a input file formatted in below.
ders : bilgisayargiris
hoca : erdogan
kod : 101
akts : 5
gtukred : 3
donem : 1
info : bu derste bilgisayar  falan .Also ogretiliyor confusing,blah,words,blah
Also ogretiliyor someshit.
soru : flip-flop devre nedir
cevap : erdoz
-
Basically i am reading a file with txt filled like this , getting right sides of colons and assigning them to my data in class. Character "-" used as an indicator that file is going for another information struct/piece.
Here's part of code i am struggling with below.
public void read(){
    className = this.getClass().getSimpleName();
    className = className + ".txt";
    openFile(className);
    readFile();
    System.out.println(className);
    closeFile();
}
public void openFile(String filer){
    try{
        scan =  new Scanner(new File("/home/paypaytr/IdeaProjects/yallah/src/a.txt")); //test purposes
    }
    catch (Exception e){
        System.out.println(className+"couldnt found.");
        //some safe quit mechanicsm
    }
}
 public void readFile(){
        while (scan.hasNextLine()){
            if(scan.nextLine()=="ders"){
                scan.nextLine(); //this is for skipping ":" but would love to delim it.
               name = scan.nextLine();
            }
            else if(scan.nextLine()=="hoca"){
                scan.nextLine(); //this is for skipping ":" but would love to delim it.
                tutor = scan.nextLine();
            }
            else if(scan.nextLine()=="kod"){
                scan.nextLine(); //this is for skipping ":" but would love to delim it.
                code = scan.nextInt();
            }
            else if(scan.nextLine()=="akts"){
                scan.nextLine(); //this is for skipping ":" but would love to delim it.
                akts = scan.nextInt();
            }
            else if(scan.nextLine()=="gtukred"){
                scan.nextLine(); //this is for skipping ":" but would love to delim it.
                gtukred = scan.nextInt();
            } else if(scan.nextLine()=="donem"){
                scan.nextLine(); //this is for skipping ":" but would love to delim it.
                donem = scan.nextInt();
            }
            else if(scan.nextLine()=="info"){
                scan.nextLine(); //this is for skipping ":" but would love to delim it.
                while(scan.nextLine()!="soru")
                info += scan.nextLine();
            }
            else if(scan.nextLine()=="soru"){
                scan.nextLine(); //this is for skipping ":" but would love to delim it.
                soru = scan.nextLine();
            }
            else if(scan.nextLine()=="cevap"){
                scan.nextLine(); //this is for skipping ":" but would love to delim it.
                cevap = scan.nextLine();
            }
        }
    }
public void closeFile(){
    scan.close();
}
Can someone please help ?
 
     
     
     
     
    