lundi 9 novembre 2015

how to change if-else statment to switch case statment in java

My question is how to change if-else statement to switch case statement, I've done some work and it contain error in netbean:

if(result.length <= 2){
            if ((result[0].equals("UC"))||(result[0].equals("uc"))){
                fix = "UC";
            }
            else if ((result[0].equals("LC"))||(result[0].equals("lc"))){
                fix = "LC";
            }
            else
                fix = "error";  
        }else
            fix = "length";

Aucun commentaire:

Enregistrer un commentaire