Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
To check multiple conditions.
To execute a block of code if a condition is true.
To execute a block of code if a condition is false.
None of the above.
if (condition) { } else { }
if (condition) { } else if (condition) { } else { }
switch (expression) { case value: statements; default: statements; }
if (condition) { } else { } if (condition) { }
if (condition) { } if (condition) { } else { }
if { } else if { } else { }
if (condition) { }
unless (condition) { }
unless { } else { }
unless (condition) { } else { }
when (expression) { case value -> statements }
It is used to check multiple conditions.
It can be used as a replacement for the switch statement.
It can be nested within other conditional statements.
All of the above.
To check for a specific condition.
To execute a block of code if none of the cases match.
To execute a block of code if the switch expression is null.
when (expression) { case value -> statements; default -> statements }
when (expression) { value -> statements }
when (expression) { value -> statements; default -> statements }