Java Reference
In-Depth Information
Self-Test Exercises
47. When run in default mode, does javadoc ever extract the body of a method defi-
nition? When run in default mode, does javadoc ever extract anything marked
private in a class definition?
48. When run in default mode, what comments does javadoc extract and what com-
ments does it not extract?
Chapter Summary
A static method is one that does not require a calling object, but can use the class
name in place of the calling object.
A static variable is similar to an instance variable except that there is only one copy
of the static variable that is used by all objects of the class.
A wrapper class allows you to have a class object that corresponds to a value of a
primitive type. Wrapper classes also contain a number of useful predefined con-
stants and static methods.
A variable of a class type stores the reference (memory address) of where the object
is located in the computer's memory. This causes some operations, such as = and
== , to behave quite differently for variables of a class type than they do for vari-
ables of a primitive type.
When you use the assignment operator with two variables of a class type, the two
variables become two names for the same object.
A method cannot change the value of a variable of a primitive type that is an argu-
ment to the method. On the other hand, a method can change the values of the
instance variables of an argument of a class type. This is because with class param-
eters, it is a reference that is plugged in to the parameter.
null is a special constant that can be used to give a value to any variable of any
class type.
An expression with a new operator and a constructor can be used as an argument
to a method. Such an argument is called an anonymous object .
A copy constructor is a constructor with one parameter of the same type as the class.
A copy constructor should be designed so the object it creates is intuitively an exact
copy of its parameter, but a completely independent copy, that is, a deep copy.
A class that contains mutator methods or any methods that can change the data in
an object of the class is called a mutable class , and objects of the class are called
mutable objects . When defining accessor methods (or almost any methods), your
Search WWH ::




Custom Search