Java Reference
In-Depth Information
Terms introduced in this chapter
abstraction, modularization, divide and conquer, class diagram, object diagram,
object reference, overloading, internal method call, external method call, dot
notation, debugger, breakpoint
Concept summary
abstraction Abstraction is the ability to ignore details of parts, to focus attention on a higher
level of a problem.
modularization Modularization is the process of dividing a whole into well-defined parts that
can be built and examined separately and that interact in well-defined ways.
classes define types A class name can be used as the type for a variable. Variables that
have a class as their type can store objects of that class.
class diagram The class diagram shows the classes of an application and the relationships
between them. It gives information about the source code and presents the static view of a
program.
object diagram The object diagram shows the objects and their relationships at one moment
in time during the execution of an application. It gives information about objects at runtime and
presents the dynamic view of a program.
object references Variables of object types store references to objects.
primitive type The primitive types in Java are the non-object types. Types such as int ,
boolean, char, double , and long are the most common primitive types. Primitive types
have no methods.
object creation Objects can create other objects, using the new operator.
overloading A class may contain more than one constructor, or more than one method of the
same name, as long as each has a distinctive set of parameter types.
internal method call Methods can call other methods of the same class as part of their im-
plementation. This is called an internal method call.
external method call Methods can call methods of other objects using dot notation. This is
called an external method call.
debugger A debugger is a software tool that helps in examining how an application executes.
It can be used to find bugs.
Exercise 3.43 Use the debugger to investigate the clock-display project. Set breakpoints
in the ClockDisplay constructor and each of the methods, and then single-step through
them. Does it behave as you expected? Did this give you new insights? If so, what were they?
Exercise 3.44 Use the debugger to investigate the insertMoney method of the better-
ticket-machine project from Chapter 2. Conduct tests that cause both branches of the if state-
ment to be executed.
Search WWH ::




Custom Search