Practice with return value method

Practice with return value method

public class HelloWorld {
    
    
    public static void main(String[] args) {
    
    
        int max = getMax(10,20);
        System.out.println("较大值是:"+max);
    }

    public static int getMax(int a, int b) {
    
    
        if (a < b) {
    
    
            return b;
        } else {
    
    
            return a;
        }
    }
}

Guess you like

Origin blog.csdn.net/taoyingle/article/details/115116736