This chapter introduces object oriented programming (OOP)
as implemented in Java. We begin in the Java
section with a discussion of the class definition, which specifies
the attributes - the data fields and methods - that a class object
will own. We provide several demonstration programs to illustrate
different aspects of the class definition.
As discussed in the previous chapter,
you do not need to grasp fully all the concepts of OOP to begin
writing Java programs. In fact, only by writing programs will the
full understanding arrive.
To assist in writing non-trivial programs at this early stage,
we introduce some useful tools. The numerical wrapper
classes provide a number of helpful functions such as converting
string representations to primitive type values. We also give a
brief introduction to arrays
and also to exceptions,
which indicate Java error conditions.
The Supplements
offer additional tutorial material for those who have not previously
encountered OOP concepts such as in C++. For those with more experience
with OOP, the supplements also offer more details about how the
differences between C++ and Java, Java memory management, and the
class definition in the JVM.
The Tech and Physics
sections review object oriented techniques in engineering and science
applications. We begin developing the Histogram
tool that we will use in the rest of the course.
Chapter 3: Contents
Java
Supplements:
- More about classes and objects. For those who not familiar with
object oriented programming concepts. Topics include
- More advanced topics include:
Tech
Physics
Latest update: Dec.13.2003
|