RE: An interesting fact about java branches

You are viewing a single comment's thread from:

An interesting fact about java branches

in java •  4 years ago 

Well, there is a reason behind it. Although we humans can be sure that the right and left codes are equivalent, the compiler scans the branching first and can't make sure that one of the statements will be executed. It does not know inside statements at this stage; so it will assume that "maybe", none of the statements will be executed. So it will raise an error.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!