|Lesson 4||Working with objects|
|Objective||Describe how Objects are referenced.|
ClassName variable = new ClassName(argumentList);
ClassNamehas a field variable named
field1and a method named
field1may be accessed as
method1()may be invoked as
thiskeyword to refer to the current object instance. The
thiskeyword is used within constructors and non-
thisis used within a constructor, it refers to the object being created.
staticmethod, it refers to the object whose method is being invoked. Since
staticmethods are not associated with an instance of a class, you should not use
superkeyword is similar to
this, except that it refers to the superclass of the current object instance. The
superkeyword is used to access field variables and methods of an object's superclass that may have been hidden or overridden by those of the object's class.