方法 比较大小

package method;

public class Demo02 {
public static void main(String[] args) {

int max = max(10, 20);
System.out.println(max);
}
//比大小
public static int max(int num1,int num2){

int result = 0;
if (num1==num2){
System.out.println("num1==num2");
return 0;
}
if(num1>num2){
return num1;
}else {
result = num2;

}
return result;
}

}
posted @ 2021-08-26 16:36  AAA编程  阅读(36)  评论(0)    收藏  举报