Review Overload
作者:互联网
Review Overload
重载
什么是重载?
重载:同一个方法,有不同的参数个数或者参数类型;
解释:方法名必须相同,参数的个数不同或者参数的类型不同;
public int mOL(int b,int c) {
return c*b;
}
public void mOL(char h) {
System.out.println(h);
}
package com.jxnu.sdream;
public class Overload1 {
public int mOL(int a) {
return a*a;
}
public int mOL(int b,int c) {
return c*b;
}
public void mOL(char h) {
System.out.println(h);
}
public static void main(String[] args) {
Overload1 ob=new Overload1();
ob.mOL('r');
System.out.println(ob.mOL((int)Math.sqrt(520)));;
System.out.println(ob.mOL(5, 104));;
}
}
标签:int,Review,System,Overload,ob,mOL,public,out 来源: https://blog.csdn.net/m0_46891572/article/details/122463324