Home : Course Map : Chapter 3 :
Classes and Objects in Java
JavaTech
Course Map

Introduction
Class Definition
Data Fields
Methods
Constructors
Instantiation
  
Demo 1
  Demo 2
Static Members
  Demo 3

Value&Reference
  Demo 4
Overloading
   Demo 5
Wrappers 
  Demo 6
Autobox/Unbox
   Demo 7
Arrays
  Demo 8
Exceptions
Exercises

    Supplements
MoreAboutObjects
Creating Types

Classes,Objs&JVM

Java OOP vs C++
Garbage Collection
     About JavaTech
     Codes List
     Exercises
     Feedback
     References
     Resources
     Tips
     Topic Index
     Course Guide
     What's New

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:

Tech

Physics

Latest update: Dec.13.2003

           Tech
OOP in Tech Apps
Complex Number
Histogram Class
  Demo
More Wrappers

           Physics
OOP in Physics
Particle Class
Root Finding
  Demo 1
Newton Methods
  Demo 2
Exercises

  Part I Part II Part III
Java Core 1  2  3  4  5  6  7  8  9  10  11  12 13 14 15 16 17
18 19 20
21
22 23 24
Supplements

1  2  3  4  5  6  7  8  9  10  11  12

Tech 1  2  3  4  5  6  7  8  9  10  11  12
Physics 1  2  3  4  5  6  7  8  9  10  11  12

Java is a trademark of Sun Microsystems, Inc.