| Home Introduction Using Holon Holon Tools Contact
HolonJForth |
Constructors
Initial ValuesThe conventional Java compiler silently adds two methods to a class file, which serve to set the variables to initial values. When you write int X = 7, Java compiles the "= 7" operation in the method <init>, if X is an instance variable, or in the method <clinit>, if X is a static class variable. In HolonJ the mechanism is open. We write the initialization methods explicitly, if there are values to initialize. You don't have to initialize zero and null values. The JVM does this when it creates the fields. <init> is called, when an instance of the class is created. It must first initialize the super class, then other actions follow.
Example:
The method <clinit> is called, when the class has been loaded into the JVM.
|
|
| © 1999-2005 Wolf Wejgaard |