Chapter 11. Creating Classes


[Page 343]

11.1

IDENTIFYING THE OBJECTS AND FIELDS

11.2

DEFINING A CLASS

11.3

OVERLOADING CONSTRUCTORS

11.4

CREATING AND INITIALIZING AN ARRAY

11.5

CREATING ACCESSORS (GETTERS) AND MODIFIERS (SETTERS)

11.6

CREATING A MAIN METHOD

11.7

JAVADOC COMMENTS

11.8

CREATING ANOTHER CLASS

11.9

REUSING A CLASS VIA INHERITANCE

11.10

CONCEPTS SUMMARY


Chapter Learning Objectives

The computer science goals for this chapter are:

  • To define a class including the fields, constructors, and methods.

  • To override an inherited method.

  • To start using a debugger.

  • To overload constructors.

  • To create, initialize, access, and process an array.

  • To create accessor and modifier methods.

  • To introduce runtime exceptions.

  • To create a main method.

  • To create Javadoc comments.

  • To introduce dynamic binding.

In object-oriented programming the focus is on objects. We identify the objects that we will need to accomplish a task. We determine a type for those objects (classify them) and write a class definition for each type. The class definition contains information on the data for each object (the fields), the different ways to initialize the data for each new object (the constructors), and the things objects will need to know how to do (the methods). Up to now we have only written methods, but now we will write entire classes. Each class will have fields, constructors, and methods.


[Page 344]


Introduction to Computing & Programming Algebra in Java(c) A Multimedia Approach
Introduction to Computing & Programming Algebra in Java(c) A Multimedia Approach
ISBN: N/A
EAN: N/A
Year: 2007
Pages: 191

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net