will always execute.
For example,
int u=5, v=10;
if ( u>v);
System.out.println(“u is greater than v” + u);
The if statement in this code snippet is prematurely terminated with a semicolon. Because
the println statement is not connected to the if statement, it will always execute.
2. Now consider another example,
if( salary > 200000)
{
tax = .30 * basic;
bonus = 800;
}
Herein, if the condition is true, then both of the statements in the braces will be executed in
the order they appear. But if, say, the braces were left out or missed by mistake by the
programmer, then the if statement conditionally executes only the very next statement—that is,
Do'stlaringiz bilan baham: |