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 191 views
1 answer 203 views
2 answers 287 views
1 answer 273 views
3 answers 413 views
1 answer 291 views
...