► |  | How to Design Classes Languages

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

▼ | 2 | Professor J Intermediate

2.1 | import
2.2 | class
2.3 | interface
2.4 | Field
2.5 | Method
2.6 | Constructor
2.7 | Statement
2.8 | Expression

Version: 4.1.4
top← prev up next →

### 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 $.

top← prev up next →