Expression Statements
Certain kinds of expression are counted as statements. You write any expression, put a semicolon after it, and voila, it's an expression statement. In particular, an assignment, method invocation, the creation of a object by calling a constructor (looks like a method call, and the keyword “new” is used so we can tell them apart), and pre-increment, post-increment, and decrement are all expressions that can be statements.
a = b; // assignmentw.setSize(200,100); // method invocationnew WarningWindow(f); // instance creation++i; // pre-increment
An expression statement is executed by evaluating the expression.
If the expression is an instance creation, you usually save a reference to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access