Computer Applications
What is a compound statement? Give an example.
Input in Java
59 Likes
Answer
Two or more statements can be grouped together by enclosing them between opening and closing curly braces. Such a group of statements is called a compound statement.
if (a < b) {
/*
* All statements within this set of braces
* form the compound statement
*/
System.out.println("a is less than b");
a = 10;
b = 20;
System.out.println("The value of a is " + a);
System.out.println("The value of b is " + b);
}
Answered By
40 Likes
Related Questions
Write the syntax of 'if' statement.
Define the following:
(a) Normal flow of control
(b) Conditional flow of control
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?