




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















Objects & Classes ñ Extending
Fall 2007
The javadoc Documentation System
I (^) One of the important ways in which Java works together with the WorldñWideñWeb is in the design of its
generates documentation for each class in the le.
I (^) Complete documentation for the ACM Java Libraries is located at:
Writing javadoc Comments
documentary web pages automatically from the Java source code.
I (^) To make this work with your own programs, you need to add specially formated comments to your code.
does.
I (^) Please read the book for more information.
I (^) Class : a collection of (usually related) data, along with the methods or operations capable of accessing it
I (^) Data members : the storage components of a class
I (^) Member functions : the messages or methods of a class, used to access and modify the data members
I (^) Must declare (instantiate) an object of the class before allowed to store data in it or send it a message
I (^) Fundamental Data Types I (^) Examples: int , double , boolean I (^) Objects of a fundamental type have:
I (^) Java Classes I (^) Examples: String , GRect , GPoint I (^) Objects of a class have:
A Wall Clock... An Alarm Clock...
A Grandfather Clock... A Wristwatch...
E A Wall clock is a kind of clock ⇒ Clock that hangs on a wall
E An Alarm clock is a kind of clock ⇒ Clock with an alarm
E A Grandfather clock is a kind of clock ⇒ Clock with a pendulum and chimes
E A Wristwatch is a kind of clock ⇒ Clock that straps to your arm
E Wall clocks, Alarm clocks, Grandfather clocks, and Wristwatches are specialized clocks
Wouldn't it be nice to be able to create specialized program objects without starting from scratch?
For example:
I (^) Blinking rectangles
I (^) Moving circles
I (^) Arbitrary precision numbers
Inheritance is the objectñoriented programming mechanism for specialization.
I (^) Inheritance is the ability to dene new classes of objects using existing classes as a basis.
I (^) The new class inherits the attributes and behaviors of the parent classes.
I (^) The new class ISñA specialized version of the parent class.
I (^) A natural way to reuse code I (^) Programming by extension rather than re-invention
I (^) Object-oriented paradigm is wellñsuited for this style of programming
I (^) Terminology I (^) Parent , base, or superclass
I (^) Derived or subclass
I (^) Constructors : Create an object, provide initial values
I (^) Mutators : Change the state or attributes
I (^) Inspectors : Determine something about the state
I (^) Facilitators : Perform a task