Nelianjackhx Nelianjackhx
  • 07-11-2016
  • Computers and Technology
contestada

Write the definition of a method min that has two int parameters and returns the smaller.

Respuesta :

kingburrito
kingburrito kingburrito
  • 07-11-2016
public class ExampleMinNumber {
     public static void main(String[] args) {
          
int a = 11;
         
int b = 6;
          int c = minFunction(a, b);
     System.out.println("Minimum Value = " + c);
}

/** returns the minimum of two numbers */
public static int minFunction(int n1, int n2) {
    
int min;
    
if (n1 > n2)
       
min = n2;
    else 
       min = n1;
  return min;
   }
}
java 8.0
Answer Link

Otras preguntas

What do you do to add the area
(1/6 divided by 8/11), What's the answer??
What role did the panic of 1893 play in the election of 1896?
How long do misdemeanors stay on your record?
What is the real name for the pound sign?
Which combination of factors would result in the lowest monthly mortgage payment? A.) Big down payment, a longer term loan, and low interest rate B.) Big down p
How did the Industrial Revolution contribute to the beginning of the Civil War? a. the south depended totally on crop exports like cotton for their economy b.
T varies inversely with the cube of W. When W is 3, T is 1/9. Find the value of W when T is 1/243
How are the cities along the Indus River connected to the other cities in western India?
For a school drama performance, student tickets cost $5 each and adult tickets cost $10 each. The sellers collected $3,570 from 512 tickets sold. If c is the nu