package 课堂代码; public class Test3 { public static void main(String[] args) { //定义一个方法,求两个整数的最大值,把最大值返回 int c = printMax(10,60); System.out.println("最大值为: " +c); } public static int printMax(int a,int b){ int max = 0; if (a > b){ b = a; max = b; }else if (a < b){ a = b; max = a; } return max ; } }
定义一个方法,求两个整数的最大值,把最大值返回
最新推荐文章于 2024-05-09 20:43:19 发布