下面选项中,可以和int max(int a,int b,double c)方法构成重载关系的是( )
A、double max(int a,int b)
B、void max(int a,double c,int b)
C、double max(double a,double b)
D、int max(int x,int y,double z)
重载的特征:方法名相同,参数列表不同;只关注这两个点,其他无需关注! 所以 A,B,C都对
int a,int b,double c
int a,double c,int b
参数完全一样
重载规则:
重载(overloading) 是在一个类里面,方法名字相同,而参数不同。返回类型可以相同也可以不同。
重载 必须是返回类型和方法名字一致
参数不一致