private String getString1(int n){
if (n == 0) {
return "ZERO";
}
if (n == 1) {
return "ONE";
}
if(n == 2) {
return "TWO";
}
return "-NA-";
}
private String getString2(int n){
if (n == 0) {
return "ZERO";
} else if (n == 1) {
return "ONE";
} else if(n == 2) {
return "TWO";
} else
return "-NA-";
}
I have the above methods getString1(int) and getString2(int). Both will give the same o/p. But which one is the most efficient way of using? In there any difference in term of performance?
Aucun commentaire:
Enregistrer un commentaire