Home java Comparison of the minimum number of four numbers

# Comparison of the minimum number of four numbers

Author

Date

Category

Please tell me how the program understands how min (C, D) is calculated; After all, it is not written, but only a number is written to the minimum of Min (A, B), however, the program works correctly.

``````Public Static Int Min (Int A, Int B, Int C, Int D) {
if (min (a, b) & lt; min (c, d)) {
RETURN MIN (A, B);
} else {
RETURN MIN (C, D);
}
}
Public Static Int Min (Int A, Int B) {
IF (A & LT; B)
RETURN A;
ELSE.
Return B;
``````

are different a, b .. maybe it will be clearer?

``````Public Static Int Min (Int A, Int B, Int C, Int D) {
if (MIN (A, B) & LT; MIN (C, D)) {// Call MIN (E, F) with the parameters E = A, F = B and E = C, F = D
RETURN MIN (A, B);
} else {
RETURN MIN (C, D);
}
}
Public Static Int Min (int e, int f) {
IF (E & LT; F)
Return E;
ELSE.
RETURN F;
}
``````

There are two different functions, one with a four parameters, the other with two. That from four calls several times the one with two.

``````min (1,2) - & gt; 1
min (1,2,3,4) - & gt; min (1,2) & lt; min (3.4)? MIN (1,2): min (3.4) - & gt; 1
``````
Previous articleJava keyboard input

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.