+ 1
Faster at runtime
I am wondering which statements are faster at run-time : normal if-else statement (if{}else {}) or ?: operator (condition?:true:false)
3 odpowiedzi
0
probably the ? operator beacause the code is shorter so you dont need that much bits
~Kamil
0
On my point of view there is no really essential difference between the two variants.
It is just used to shorten the program. Normally you're writing much more code after an if - condition. But if you're simply manipulating the value of a variable, you can also use the ?:-condition.
But the major advance of if-conditions is, that they can be nested.
- 1
that is no proper reason.
java is translated into bytecode so your argument is lacking.
my guess is, they are equal.