Package-level declarations

Types

Link copied to clipboard
open class AssertStmt : Statement
A usage of the keyword "assert" In assert dead : "Wasn't expecting to be dead here"; the check is "dead" and the message is the string.
Link copied to clipboard
Link copied to clipboard
Statements in between { and }.
Link copied to clipboard
open class BreakStmt : Statement

The break statement

Java 1.0-11

Break has an optional label: break;break somewhere;The label is in the "value" property as a NameExpr.
Link copied to clipboard
The catch part of a try-catch-finally.
Link copied to clipboard
A continue statement with an optional label; continue brains;continue;
Link copied to clipboard
Link copied to clipboard
open class EmptyStmt : Statement
An empty statement is a ";" where a statement is expected.
Link copied to clipboard
Used to wrap an expression so that it can take the place of a statement.
Link copied to clipboard
Link copied to clipboard

The classic for statement

Examples:
  1. for(int a=3, b=5; a<99; a++, b++) hello();
  2. for(a=3, b=5; a<99; a++) { hello(); }
  3. for(a(),b();;) hello();
  • initialization is a list of expressions. These can be any kind of expression as can be seen in example 3, but the common ones are a single VariableDeclarationExpr (which declares multiple variables) in example 1, or a list of AssignExpr's in example 2.
  • compare is an expression, in example 1 and 2 it is a BinaryExpr. In example 3 there is no expression, it is empty.
  • update is a list of expressions, in example 1 and 2 they are UnaryExpr's. In example 3 there is no expression, the list empty.
  • body is a statement, in example 1 and 3 it is an ExpressionStmt. in example 2 it is a BlockStmt.
Link copied to clipboard
An if-then-else statement.
Link copied to clipboard
open class LabeledStmt : Statement
A statement that is labeled, like label123: println("continuing");
Link copied to clipboard

A class declaration inside a method.

Java 1.0

Not available.
Link copied to clipboard

A record declaration inside a method.

Link copied to clipboard
open class ReturnStmt : Statement
The return statement, with an optional expression to return.
Link copied to clipboard
abstract class Statement : Node
A base class for all statements.
Link copied to clipboard

One case in a switch statement

The main Javadoc is in SwitchStmt

Java 1.0-11


switch (i) {
  case 1:
  case 2:
    System.out.println(444);
    break;
  default:
    System.out.println(0);
}
This contains three SwitchEntrys.
Link copied to clipboard

The switch statement

Java 1.0-1.4

The basic C-like switch statement.
Link copied to clipboard
Link copied to clipboard
Usage of the throw statement.
Link copied to clipboard
open class TryStmt : Statement

The try statement

Java 1.0-6

try {
// ...
} catch (IOException e) {
// ...
} finally {
// ...
}
In this code, "// do things" is the content of the tryBlock, there is one catch clause that catches IOException e, and there is a finally block.
Link copied to clipboard
A statement that had parse errors.
Link copied to clipboard
Link copied to clipboard

The yield statement

Java 1.0-11

Does not exist.