This page describes the current methods in the Object class at this point in time. It
is possible that additional Java-defined methods might be added later, such as Thread
support methods. It is also possible that extensions might be added, if needed.
The default constructor method uses no parms. It creates a hashcode for this
object and sets the object reference counter to 1. Memory is allocated to hold the object
data structure. In C++ code format, this is called when an Object variable is defined, as
Object myObject; // calls the default Object constructor
Note that one would NOT see the Java-version, such as:
Object myObject = new Object();
The assignment operator overloads the assignment operation. For example, in
Object Potato; // calls the default constructor
Object Spud; // calls the default constructor
Spud = Potato; // calls the assignment method
the "Spud = Potato;" statement decrements the reference counter in the Spud data
structure (which goes to 0 and the data structure memory is deleted), sets the
Spud data structure pointer to the Potato data structure, and increments the
reference counter in the Potato data structure. We now have just one data
structure allocated in system memory, with two references or handles to it.
The copy constructor sets a variable as a reference to an object. In Java:
Object myObjectRef = myObject;
Normal C++ does this as:
Object & myObjectRef = myObject;
However, this system uses "smart objects", which "look" like different C++ objects, but
are actually different references to the same object data. For example:
Object myObjectRef = myObject; // calls the Object copy constructor
The destructor method is called during runtime when a reference to an object goes
out of scope. The destructor decrements the reference count to the object data, and
deletes the data memory when the reference count hits 0. This acts as Garbage
Collection for this system.
The clone method will be implemented if it is needed.
The equals method will be implemented soon. Two objects are considered to be
equal if they both refer to the same memory location allocated to hold the object data.
The finalize method isn't needed, since we don't need a Garbage Collector.
The getClass method will be implemented if it is needed. There is no Class class
The hashCode method seems to work. It is defined as an unsigned long data type.
The toString method is being developed along with the String class.
Thread related functions are not yet implemented because I don't know how to do
them yet, and I don't need them yet:
wait (long timeout)
wait (long timeout, int nanos)