► |  | How to Design Classes Languages

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

▼ | 4 | Professor J Advanced

4.1 | package
4.2 | import
4.3 | class
4.4 | interface
4.5 | Modifiers
4.6 | Field
4.7 | Method
4.8 | Constructor
4.9 | Statement
4.10 | Array Init
4.11 | Expression

Version: 4.1.4
top← prev up next →

#### 4.6`` Field

- Type Id ;

  Creates a field, bound to Id, that can be used within the current class, or on instances of the current class using an expression. This field will have the declared type and will contain a default value of this type if uninitialized.

- Type Id = Expression ;

  Creates a field, bound to Id, that can be used within the current class, or on instances of the current class using an expression. This field will have the declared type and the value of the evaluated Expression.

- Type Id = ArrayInit ;

  Creates a field, bound to Id, that can be used within the current class, or on instances of the current class using an expression. This field must have an array type and the value is that of the evaluated array initialization specification.

All fields with static preceeding their declaration are tied to the class and not tied to an instance of the class. They can be accessed and initialized using the standard techniques for non-static fields. They may also be accessed with the class name preceeding the field name: Id.Id. An initializing expression cannot use the this expression.

top← prev up next →