► |  | How to Design Classes Languages

1 | Professor J Beginner
2 | Professor J Intermediate
3 | Professor J Intermediate + Access
4 | Professor J Advanced
| Index

▼ | 3 | Professor J Intermediate + Access

3.1 | import
3.2 | class
3.3 | interface
3.4 | Modifiers
3.5 | Field
3.6 | Method
3.7 | Constructor
3.8 | Statement
3.9 | Expression

Version: 4.1.4
top← prev up next →

### 3`` ProfessorJ Intermediate + Access

Program

=

Import ... Def ...

Import

=

import Name ;
import Name.* ;

Def

=

Class
Interface
public Class
public 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
Modifier Field
Method
Modifier Method
Constructor
Modifier Constructor

Modifier

=

public
private
protected

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 ,...) ;
this (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 $.

top← prev up next →