Computer Applications
Explain if-else construct
Input in Java
21 Likes
Answer
In if-else construct, the user defines the statements to be executed when the condition results in true or false. If the given condition results in true, the statements in the 'if' block are executed and if the given condition results in false, the statements in the 'else' block are executed.
The syntax of if-else construct is as follows:
if(condition)
Statement 1 //executed if condition is true
else
Statement 2 //executed if condition is false
Answered By
15 Likes
Related Questions
Distinguish between Syntax error and Logical error.
Write down the syntax of the following with reference to Java Programming:
(a) to accept an integer value using main( )
(b) to accept a fractional number using main( )
What are the different types of errors that take place during the execution of a program?
Explain if-else-if construct