next up previous
Next: 1.3.3 The Structure of Up: 1.3 Java Notation and Previous: 1.3.1 Java Expressions

1.3.2 Java Statements

Since the Java expression language is not very rich, Java programs express computations as sequences of statements rather than as compound expressions. The most common form of Java statement is an assignment statement
var = expr ;
where var is a Java variable and expr is an expression of type compatible with the type of var.

In Java, an assignment is technically an expression, exactly as it is in C. Hence, Java will accept assignments that are embedded inside expessions. This coding practice is considered bad style in Java and will not be mentioned again in this monograph.



Robert Cartwright, Spring 1999