public class Overloading{
  public static void main(String[] args){
    max(2, 3);
    max(3, 4, 5);
  }

  static void max(int x, int y){
    if(x >= y){
      System.out.println(x);
    }else{
      System.out.println(y);
    }
  }

  static void max(int x, int y, int z){
    if(x >= y){
      if(x >= z){
        System.out.println(x);
      }else{
        System.out.println(z);
      }
    }else{
      if(y >= z){
        System.out.println(y);
      }else{
        System.out.println(z);
      }
    }
  }
}

Variables










































public class Overloading { public static void main (String[] args) { max( 2 , 3 ); max( 3 , 4 , 5 ); } static void max ( int x, int y) { if (x >= y){ System.out.println(x); } else { System.out.println(y); } } static void max ( int x, int y, int z) { if (x >= y){ if (x >= z){ System.out.println(x); } else { System.out.println(z); } } else { if (y >= z){ System.out.println(y); } else { System.out.println(z); } } } } Variables