2 ProfessorJ Intermediate

  Program

 

=

 

Import ... Def ...

  Import

 

=

 

import Name ; 

import Name.* ; 

  Def

 

=

 

Class

Interface

  Class

 

=

 

class Id {Member ...}

class Id implements Id ,Id ... {Member ...}

class Id extends Id {Member ...}

class Id extends Id implements Id ,Id ... {Member ...}

abstract class Id {Member ...}

abstract class Id implements Id ,Id ... {Member ...}

abstract class Id extends Id {Member ...}

abstract class Id extends Id implements Id ,Id ... {Member ...}

  Interface

 

=

 

interface Id {Signature ...}

interface Id extends Id ,Id ... {Signature ...}

  Signature

 

=

 

MethodReturn Id (Type Id ,...) ; 

abstract MethodReturn Id (Type Id ,...) ; 

  Member

 

=

 

Field

Method

Constructor

  Field

 

=

 

Type Id = Expression ; 

Type Id ; 

  Method

 

=

 

MethodReturn Id (Type Id ,...) {Statement ...}

abstract MethodReturn Id (Type Id ,...) ; 

  MethodReturn

 

=

 

void

Type

  Constructor

 

=

 

Id (Type Id ,...) {Statement ...}

  Statement

 

=

 

if (Expression) {Statement ...} else {Statement ...}

return Expression ; 

return ; 

{Statement ...}

super (Expression ,...) ; 

Type Id ; 

Type Id = Expression ; 

StatementExpression ; 

  StatementExpression

 

=

 

Id (Expression ,...)

Expression.Id (Expression ,...)

super.Id (Expression ,...)

  Expression

 

=

 

Expression Op Expression

- Expression

! Expression

this

Id. (expression ,...)

Expression.Id (Expression ,...)

super.Id (Expression ,...)

Expression.Id

new Id (Expression ,...)

(Type) Expression

Expression instanceof Type

check Expression expect Expression

check Expression expect Expression within Expression

(Expression)

Id

Number

Character

String

null

true

false

  Name

 

=

 

Id. ... Id

  Op

 

=

 

+

-

*

/

<

<=

==

>

>=

&&

||

  Type

 

=

 

Id

boolean

int

char

double

float

long

byte

short

An Id is a sequence of alphanumeric characters, _, and $.