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 171 views
1 answer 255 views
2 answers 204 views
1 answer 166 views
1 answer 136 views
136 views asked Aug 17, 2021 by avibootz
1 answer 297 views
1 answer 152 views
...