Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Class definition

Syntax

Nested classes are allowed; however, classes are only allowed in package blocks and top-level region. When nested in another class, contributes a static property.

    ClassDefinition :
      class IdentifierName ClassNullabilityopt TypeParametersopt Inheritance Block
    ClassNullability :
      !
    TypeParameters :
      . < TypeParameterList ParameterizedGreaterThan
    TypeParameterList :
      TypeParameter
      TypeParameterList , TypeParameter
    TypeParameter :
      Identifier

Semantics

ClassNullability is currently ignored as exclamation ! is the default for every class.

Class inheritance

Syntax

    Inheritance :
      «empty»
      extends TypeExpression
      implements TypeExpressionList
      extends TypeExpression implements TypeExpressionList