publicclass overload {publicstaticvoidmain(String[] args) {int sum1 = add(10,20);System.out.println(sum1);double sum2 = add(10.1,20);System.out.println(sum2);double sum3 = add(10,20.2);System.out.println(sum3);double sum4 = add(10,20,30);System.out.println(sum4);int sum5 = add(10,20,30,40);System.out.println(sum5);double sum6 = add(10.1,20.2,30.3,40.4);System.out.println(sum6);}
① publicstaticintadd (int a,int b){return a + b ;}
② publicstaticdoubleadd (double a,int b){return a + b ;}
③ publicstaticdoubleadd (int a,double b){return a + b ;}
④ publicstaticdoubleadd (int a,int b, int c){return a + b + c ;}
⑤ publicstaticintadd (int a,int b, int c, int d){return a + b + c + d ;}
⑥ publicstaticdoubleadd (double a,double b, double c, double d){return a + b + c + d ;}
}