15 April 2021

What the heck is a class?

A class is a blueprint for the creation of objects. Writing classes allows us to create custom objects for our own uses. Both Python and Java have classes, but they work differently.

Both Python and Java can manufacture objects meeting your specification. Python, however, allows you to "stick-build" objects; you cannot do this in Java.

Objects have state, identity, and behavior. The languages take care of the identity part; they create the objects according to your specification. We will begin by specifing a very simple behavior in our example class.

We will then create Point classes in Java and Python that represent points in the plane.

A Simple Java Puzzler

Example We will create a Java class and a Python class that do the same thing.