How to find the max of 3 numbers in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        int a = 12, b = 150, c = 40;
 
        System.out.println(Math.max(Math.max(a, b), c));
    }
}
 
 
 
  
/*
run:
  
150
  
*/

 



answered Aug 17, 2021 by avibootz
...