Statement Blocks : Statement « Statement Control « Java Tutorial
- Java Tutorial
- Statement Control
- Statement
- You can have a block of statements enclosed between braces.
- If the value of expression is true, all the statements enclosed in the block will be executed.
- Without the braces, the code no longer has a statement block.
public class MainClass {
public static void main(String[] arg) {
int a = 0;
if (a == 0) {
System.out.println("in the block");
System.out.println("in the block");
}
}
}
in the block
in the block