| Home Introduction Using Holon Holon Tools Contact
HolonJForth |
Variables
The JVM stores data in fields. For every variable and constant a field record is created in the class file together with a field reference in the constant pool. Methods access the field via the field reference and address the field reference via its index in the constant pool. VariablesYou can create class fields (static = global for the class) and instance fields (accessible in objects). A variable has a type. There are basic Java types and class types. HolonJ creates a public instance field, if no attributes are given. Syntax: (attributes) type identifier int xxx ConstantsConstants are final static fields with a fixed value. Syntax: value final type identifier 88 final int Maximum ArraysThe use of arrays in HolonJ is best described with some examples.
Local VariablesSyntax: type name. : startFrame ( -- ) "()" can be used in place of "( -- )". Some constructors accept initial values. Example: 10 new myList ( int -- ) Local ArraysLocal arrays are defined and used like other arrays.
Using Fields in external packagesFields in external packages are imported.
|
|||||||||||||
| © 1999-2005 Wolf Wejgaard |