Home : Course Map : Chapter 3 : Java : Supplements :
More about Classes and Objects
JavaTech
Course Map
Chapter 3

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

As you begin to program with an object oriented language like Java, the various concepts can all seem rather vague but then they start to coalese and suddenly classes and objects all make sense. In the meantime, we can try to get across the ideas with analoges and examples.

We can first present some metaphorical analogies to class definitions and objects:

  • Molds and Pots: the class is the mold and the objects are the clay jars formed by the mold.

  • Templates and Plates: the class is the template and the objects are the forms cut according to the template.

  • Stampers and labels: the class is the ink stamper and the objects are the labels on the papers.

(Note that we use the terms object and instance interchangably.)

In the next section, we look at the more concrete analogy of class/objects to types/data such as integer and floating point types.

In the Chapter 3: Tech section, we create a complex number class and a histogram class.

References & Web Resources

 

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.