Hello,
Does the Java Compiler optimize a statement like this
if (a == true) {
if (b == true) {
if (c == true) {
if(d == true) {
//code to process stands here
}
}
}
}
to
if (a == true && b==true && c==true && d == true)
So that's my first question: Do both take exactly the same "CPU Cycles" or is the first variant "slower".
My Second question is, is the first variant with the cascaded if considered bad programming style as it is so verbose?
(I like the first variant as I can better logically group my expressions and better comment them (my if statements are more complex than in the example), but maybe that's bad programming style?) and even slower, that's why I am asking...
Thanks Jens