Java Reference
In-Depth Information
12 . An action listener must have a method called actionPerformed .
13 . A class is a collection of data members and methods associated with those
data members.
14 . OOD starts with a problem statement and tries to identify the classes
required by identifying the nouns appearing in the problem statement.
15 . Methods of a class are identified with the help of verbs appearing in the
problem statement.
16 . To wrap values of primitive data types into objects corresponding to each
primitive type, Java provides a class , called a wrapper class. For example,
to wrap an int value into an object, the corresponding wrapper class is
Integer . Similarly, to wrap a double value into an object, the corre-
sponding wrapper class is Double .
17 . Java 5.0 simplifies the wrapping and unwrapping of primitive type values,
called the autoboxing and auto-unboxing of primitive data types.
18 . Integer objects are immutable. (In fact, wrapper classes' objects are
immutable.)
19 . To compare the values of two Integer objects, you can use the method
compareTo . If you want to compare the values of two Integer objects
only for equality, then you can use the method equals .
EXERCISES
1. Mark the following statements as true or false.
a. Every window has a width and height.
b. In Java, JFrame is a class.
c. To display the window, you need not invoke a method such as
setVisible .
d. In Java, the reserved word extends allows you to create a new class
from an existing one.
e. The window you see displayed on your screen is a class.
f. Labels are used to display the output of a program.
g. Every GUI component you need has to be created and added to a
container.
h. In Java, implements is a keyword.
i. Clicking a button is an example of an action event.
j. In a problem statement, every verb is a possible class.
k. In a problem statement, every noun is a possible method.
l. To use an object, you must know how it is implemented.
 
 
Search WWH ::




Custom Search