KnowledgeBoat Logo

Computer Applications

Explain the following statement with their constructs:

if - else

Java Conditional Stmts

73 Likes

Answer

if - else statement is used to execute one set of statements when the condition is true and another set of statements when the condition is false. It has the following syntax:

if (condition 1) {
    Statement a;
    Statement b;
    ..
}
else {
    Statement c;
    Statement d;
    ..
}

Answered By

42 Likes


Related Questions