Block of code in Java allows grouping of two or more statements. We use curly braces
{ } to denote a block of code in Java. Block of code in Java can be used where ever we use a statement.
Block of code CODE class CodeBlock OUTPUT In main block DESCRIPTION Here we have two inner blocks starting at LINE A and LINE B. Inside the second inner block we have one more block starting at LINE C. The class content and the main method content are also blocks. In total there are 5 blocks in this program. THINGS TO TRY
Block of code for if CODE class IfCodeBlock OUTPUT Excellent DESCRIPTION Here we want to print Excellent and Scholarship granted when THINGS TO TRY
|