Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
You create an object from a class by using thenew
operator and a constructor. Thenew
operator returns a reference to the object that was created. You can assign the reference to a variable or use it directly.A class controls access to its instance variables and methods by using the Java platform's access mechanism. Instance variables and methods that are accessible to code outside of the class that they are declared in can be referred to by using a qualified name. The qualified name of an instance variable looks like this:
The qualified name of a method looks like this:objectReference.variableNameorobjectReference.methodName(argumentList)The garbage collector automatically cleans up unused objects. An object is unused if the program holds no more references to it. You can explicitly drop a reference by setting the variable holding the reference toobjectReference.methodName()null
.
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2002 Sun Microsystems, Inc. All rights reserved.