简体   繁体   中英

Type mismatch: cannot convert from ArrayList<bankKonto> to boolean

public ArrayList<bankKonto> getKonto() {
    return konto;
}

And when i am in my main i add bankKontoObject to make a new one. Then i add 3 to my bankKonto

when i try to do a for loop

for(bankKonto b; bankKontoObject.getKonto() {


    System.out.println(b.getNummer()  + " " +b.getSaldo());

    }
for(bankKonto b : bankKontoObject.getKonto()) {
    System.out.println(b.getNummer()  + " " +b.getSaldo());
}

You missed a ')' at the end of 'getKonto' and the ';' should be a ':'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM