JAVA-方法练习3-三个数取较大值

package com.itheima;

//设计一个方法获取三个整数的较大值,并在控制台打印输出
public class methodmedo09 {
    public static void main(String[] args) {
        int max = getmax(10, 20, 30);
        System.out.println("10、20、30中的较大值是:"+max);
        }
    public static int getmax(int a,int b,int c){
        int tempmax=a>b?a:b;
        int max=tempmax>c?tempmax:c;
            return max;
    }
}
posted @ 2022-08-02 00:05  NiceTwocu  阅读(48)  评论(0编辑  收藏  举报