How to find the max of 3 numbers with different data types in Java

1 Answer

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

 



answered Aug 17, 2021 by avibootz

Related questions

1 answer 265 views
1 answer 347 views
2 answers 336 views
1 answer 256 views
1 answer 226 views
226 views asked Aug 17, 2021 by avibootz
1 answer 380 views
1 answer 234 views
...