+ 2

Can I use multiple IF statements?

Can I use multiple IF statements instead of ELSE IF in JAVA?

13th Sep 2017, 8:48 AM
BartƂomiej BugaƂa
BartƂomiej BugaƂa - avatar
4 Answers
+ 8
Yes Bartlomiej was right, it's called chaining as well to group multiple conditions with similar purpose. 👌
13th Sep 2017, 9:12 AM
Zephyr Koo
Zephyr Koo - avatar
+ 4
I think, I already know the answer. Both will work, but ELSE IF stops if it meets its condition... multiple IF will go on every time. So generally they are different. Else if however is more efficient
13th Sep 2017, 9:01 AM
BartƂomiej BugaƂa
BartƂomiej BugaƂa - avatar
+ 3
If else if are suited, then use them
13th Sep 2017, 9:00 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
It can work but else if would be more accurate according to me
29th Oct 2017, 8:17 AM
priyanshi
priyanshi - avatar