I have a program which I am writing which in one particular case enters every if-statement. But it isn't supposed to. I govern whether or not it should do just that by a boolean value which i send with the reference to the method. But it still won't work properly.
Here is the code snippet of the two methods included:
    void tilStasjon(String startStasjon){
        boolean sjekkStasjon=true;
        while(sjekkStasjon){
            System.out.println("Vennligst tast inn til-stasjonen: ");
            String sluttStasjon=input.next().toLowerCase();
            if(stasjonerMap.containsKey(sluttStasjon)){
                if(sluttStasjon!="ringen"){
                    sjekkStasjon=false;
                    beregnRuter(startStasjon, sluttStasjon);
                }
            }else{  
                System.out.println("Stasjon ikke funnet.");
                sjekkStasjon=true;
            }
        }
    }
    void beregnRuter(String startStasjon, String sluttStasjon){
        Stasjon til=stasjonerMap.get(startStasjon);
        Stasjon fra=stasjonerMap.get(sluttStasjon);
        ArrayList<Linje> fraLinjeListe=new ArrayList<Linje>(fra.linjeList);
        ArrayList<Linje> tilLinjeListe=new ArrayList<Linje>(til.linjeList);
        int tilStasjonsNummer, fraStasjonsNummer;
        int retning;
        double tid= 0.0;
        String endeStasjonsNavn;
        boolean overgang=false;
        tilStasjonsNummer=0;
        fraStasjonsNummer=0;
        for (int i = 0; i < fraLinjeListe.size(); i++) {
            for (int j = 0; j < tilLinjeListe.size(); j++) {
                if(fra.linjeList.get(i).equals(til.linjeList.get(j))){
                    System.out.println(fra.linjeList.get(i).linjeNummer);
                    Linje aktuellLinje=linjerMap.get(fra.linjeList.get(i).linjeNummer);
                    tilStasjonsNummer=aktuellLinje.stasjonsNummer(til);
                    fraStasjonsNummer=aktuellLinje.stasjonsNummer(fra);
                    retning=tilStasjonsNummer-fraStasjonsNummer;
                    tid=beregnTid(retning, overgang, aktuellLinje);
                    endeStasjonsNavn=aktuellLinje.endestasjon(retning);
                    System.out.println("Ta T-bane linje " + aktuellLinje.linjeNummer + " fra " + startStasjon + " til " + sluttStasjon + " i retning " + endeStasjonsNavn + ". Estimert reisetid: " + tid);             
                }   
            }
        }
    }
Below here is the method where the problem occurs. It enters both the outer if and else-if. Why is that?
    double beregnTid(int retning, boolean overgang, Linje aktuellLinje){
        double tidMellomStasjoner;
        double tid=0.0;
        int absRetning=Math.abs(retning);
        double tidOvergang;
        if(overgang=false){
            if(aktuellLinje.type==0){
                System.out.println(absRetning);
                tidMellomStasjoner=1.8;
                tid=tidMellomStasjoner*absRetning;
            }else if(aktuellLinje.type==1){
                tidMellomStasjoner=1.4;
                tid=tidMellomStasjoner*absRetning;
            }
        }else if(overgang=true){
            if(aktuellLinje.type==0){
                System.out.println("Test");
                tidOvergang=7.5;
                tidMellomStasjoner=1.8;
                tid=(tidMellomStasjoner*absRetning)+tidOvergang;
            }else if(aktuellLinje.type==1){
                tidOvergang=5.0;
                tidMellomStasjoner=1.4;
                tid=(tidMellomStasjoner*absRetning)+tidOvergang;
            }
        }
        return tid; 
    }
}
 
     
    