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 258 views
1 answer 336 views
2 answers 325 views
1 answer 250 views
1 answer 218 views
218 views asked Aug 17, 2021 by avibootz
1 answer 376 views
1 answer 228 views
...