重载方法调用重载方法:
1.参数少的调用参数多的
2.简单的调用复杂的
public class Test {
public int max(int a,int b){
return max( a, b,Integer.MIN_VALUE);
}
public int max(int a,int b, int c){
return (a>b?a:b)>c?(a>b?a:b):c;
}
}
重载方法调用重载方法:
1.参数少的调用参数多的
2.简单的调用复杂的
public class Test {
public int max(int a,int b){
return max( a, b,Integer.MIN_VALUE);
}
public int max(int a,int b, int c){
return (a>b?a:b)>c?(a>b?a:b):c;
}
}
710
358

被折叠的 条评论
为什么被折叠?