I happen to read the practicing material for SCJP certification, and I just tripped over a chapter of flow control et al, where they give the impression that "else if
" is a keyword on its own. I have always thought that it was just a normal else
, containing nothing but an if
block, braces omitted.
So, which is it?
Edit: I'd like to emphasize that this question is more in the "pique my interest" category than the "serious business" one.
Yes, they are two separate keywords—the Java language specification does not specify an else if
keyword. It is actually, as the other posters here have said, an if
statement contained inside of an else
statement.
EDIT: A lot of training/educational materials seem to imply that else if
is actually a keyword (and, indeed, it is usually treated as such), but I am inclined to think that this is more for the sake of clarity/simplicity, with the consequence of sacrificing accuracy.
it would be two separate keywords indicated by the space between the two words.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With