► |  | How to Design Classes Languages

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

▼ | 1 | Professor J Beginner

1.1 | import
1.2 | class
1.3 | interface
1.4 | Field
1.5 | Method
1.6 | Constructor
1.7 | Statement
1.8 | Expression

Version: 4.1.4
top← prev up next →

#### 1.6`` Constructor

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

Creates a constructor that is used in creating an instance of a class (called an object). The arguments given when creating an instance must be of the same type, and in the same order, as that specified by the constructor. All of the uninitialized fields of the class must be set in the constructor by the Init sequence.

this.Id = Id ;

The initialization statements pass the value provided to the constructor to the specified field for later use.

top← prev up next →