jeudi 21 septembre 2017

any shorter method to do reduce this piece of code?

//is there any other way to short this particular piece of code. //any build in function in java to solve this problem. // anyway I have written more to satisfy stack overflow that it's very simple that people will understand what I want to ask

enter code here
    if(month==1){
        month1="January";
    }
    if(month==2){
        month1="Febuary";
    }
    if(month==3){
        month1="March";
    }
    if(month==4){
        month1="April";
    }
    if(month==5){
        month1="May";
    }enter code here
    if(month==6){
        month1="June";
    }
    if(month==7){
        month1="July";
    }
    if(month==8){
        month1="August";
    }
    if(month==9){
        month1="September";
    }
    if(month==10){
        month1="October";
    }
    if(month==11){
        month1="November";
    }
    if(month==12){
        month1="December";
    }

Aucun commentaire:

Enregistrer un commentaire