lundi 27 juin 2016

Java - Multiple Boolean Conditions

I have this problem: I want to check if an int is bigger than 10, if not than if he is bigger then 100..and so on. Is there a better way than just doing this:

 public void multipleIf(int x){
    if(x > 10){
        ...
    } else if(x > 100){
        ...
    } else if(...   
 }

Thanks.

Aucun commentaire:

Enregistrer un commentaire