//比较数值大小
public class example04 {
public static void main(String[] args) {
int max = max (10,20);
System.out.println(max);
}
public static int max(int a,int b){
int result = 0;
if (a == b){
System.out.println("num1=num2");
}
if (a>b){
result = a;
}else {
result =b;
}
return result;//碰到return终止方法
}
}
Java_007 create a new method to compare the magnitude of values
Guess you like
Origin blog.csdn.net/weixin_49207937/article/details/114459269
Recommended
Ranking