Organizational Research By

Surprising Reserch Topic

Which one is faster in java? 1. Math.max(a,b); 2. (a>b)?a:b



asked Sep 13, 2013 in Core java by rajesh
edited Sep 12, 2013
0 votes
16 views



Related Hot Questions

1 Answer

0 votes
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.
answered Sep 13, 2013 by rajesh
edited Sep 12, 2013

...