(java@oneshot)logo/  logo/  logo/  logo/


 

Java Tutorial » Statement Control » Statement  
4.1.8.Statement BlocksPrevious/Next
  1. You can have a block of statements enclosed between braces.
  2. If the value of expression is true, all the statements enclosed in the block will be executed.
  3. 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
4.1.Statement
4.1.1. An Overview of Java Statements
4.1.2. Expressions
4.1.3. Declaring and defining multiple variables in a single statement
4.1.4. Label a statement block
4.1.5. Spreading a single declaration over several lines
4.1.6. How to write multiple assignments in a single statement
4.1.7. Combining both statements into one
4.1.8. Statement Blocks