0
In JAVA Tutorial, Module 4 quiz, 3rd question.
the question is to arrange the code to return the greater of the two. In that code there should be "else" part otherwise there will be two return if a>b.
1 Antwort
+ 3
no, there won't...
if(a>b) {
return a; }
returns a, if it's greater than b. if that's the case, a is returned and the method will be left. no further execution in that method.
if b is greater than a, a won't be returned, because the command won't be executed. leaving the method only to return b. no else statement needed here, because there's no other option.