Is Math.max(a,b) or (a>b)?a:b faster in Java?
java
Solution
`Math.max(a, b)` is a static function (meaning no virtual call overhead) and will likely be inlined by the JVM to the same instructions as `(a > b) ? a : b`.
Problem
Which one is faster in Java and why? - `Math.max(a,b)` - `(a>b)?a:b` (This was asked in an interview.)