I have qeustions regarding java syntax please...
Is this syntax is considered/read as the standard 'if' selection?
- MutableBigInteger t = !uOdd ? v : u;
How it's been generated in jvm?
If I want to check either the boolean value is true or false, can it be read as staadard 'if' (e.g: if (a > b) ...)
Thank you
Yep, the ternary operator ?: reads as an if statement. There is a difference though:
that operator takes just expressions while the if statement takes statements.
While I'm at it: not few people like non-double negations ;-) so your example
might be better expressed as:
-
MutableBigInteger t = uOdd ? u : v;
If you want to see what the virtual machine code looks like, try the "javap" tool
that comes with the JDK distribution.
kind regards,
Jos