Java Reference
In-Depth Information
26 . The copy constructor executes when an object is instantiated and initialized
using an existing object.
27 . The method toString is a public value-returning method. It does not
take any parameters and returns the address of a String object.
28 . The methods print , println , and printf output the string created by
the method toString .
29 . The default definition of the method toString creates a String that is the
name of the object's class name followed by the object's hash code.
30 . The modifier static in the heading of the method of a class specifies that
the method can be invoked by using the name of the class.
31 . If a data member of a class is declared using the modifier static , that data
member can be invoked by using the name of the class.
32 . static data members of a class exist even when no object of the class
type is instantiated. Moreover, static variables are initialized to their
default values.
33 . Finalizers automatically execute when a class object goes out of scope.
34 . A class can have only one finalizer, and the finalizer has no parameters.
35 . The name of the finalizer is finalize .
36 . A method of a class that only accesses (that is, does not modify) the value(s)
of the data member(s) is called an accessor method.
37 . A method of a class that modifies the value(s) of the data member(s) is called
a mutator method.
38 . Java implicitly uses the reference this to refer to both the instance variables
and the methods of a class.
39 . Classes that are defined within another class are called inner classes.
40 . A data type that specifies the logical properties without the implementation
details is called an abstract data type (ADT).
EXERCISES
1. Mark the following statements as true or false:
a. The instance variables of a class must be of the same type.
b. The methods of a class must be public .
c. A class can have more than one constructor.
d. A constructor can return a value of the int type.
e. An accessor method of a class accesses and modifies the data members
of the class.
 
 
Search WWH ::




Custom Search