The method returns the seventh day with the definition and calling

{class ReturnMethod01 public
  public static void main (String [] args) {
    // the general call
    int getMax A = (5,6);
    System.out.println (A);
    // call output
    System.out.println (getMax ( 5,6));
  }
  / * Required: given two values, the larger value between them comparing
  public static data type method name (parameter) {}
  * /
  // define a method for taking two numbers the larger value
  public static int getMax (number1 int, int number2) {
    // do comparison between the two numbers using branch statements, the two cases are provided output
    IF (number1> number2) {
    return number1;
    } the else {
    number2 return;
    }
  }
}

Guess you like

Origin www.cnblogs.com/naigoujavae/p/11371639.html