How to use the min and max methods in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        System.out.println(Math.max(4, 5));
        System.out.println(Math.max(3.5, 3.49));
        
        System.out.println(Math.min(4, 5));
        System.out.println(Math.min(3.5, 3.49));
    }
}


/*
run:

5
3.5
4
3.49

*/

 



answered Jun 12, 2019 by avibootz

Related questions

1 answer 114 views
1 answer 110 views
2 answers 160 views
1 answer 175 views
3 answers 233 views
1 answer 199 views
...