15.8. Primary Expressions

Primary expressions include most of the simplest kinds of expressions, from which all others are constructed: literals, class literals, field accesses, method invocations, and array accesses. A parenthesized expression is also treated syntactically as a primary expression.

Primary:    PrimaryNoNewArray    ArrayCreationExpressionPrimaryNoNewArray:    Literal    Type . class    void . class    this    ClassName . this    ( Expression )    ClassInstanceCreationExpression    FieldAccess    MethodInvocation    ArrayAccess

This part of the grammar of the Java programming language is unusual, in two ways. First, one might expect simple names, such as names of local variables and method parameters, to be primary expressions. ...

Get The Java® Language Specification, Java SE 7 Edition, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.