This question already has an answer here:
I have the following method in my code:
private static double mailTypeOne(double oz) {
double total;
if (oz <= 16) {
total = 3.50;
} else if (oz > 16 && oz <= 32) {
total = 3.95;
} else if (oz > 32) {
total = 3.95 + (Math.ceil((oz - 32) / 16) * 1.20);
}
return total;
}
And the return statement causes a compile error:
the variable 'total' might not have been initialized
What's the issue?
Aucun commentaire:
Enregistrer un commentaire