Skip to main content

more options

Part 4. Variables, declarations, assignments    Part 6. The class definition

Module 1, part 5. Objects and classes


This part 5 introduces you to the notions of object and class, as well as associated concepts that are needed in the beginning. The reading for this part is Gries/Gries, Section 1.3, pp. 30-41.


No. Topic Discussion
1. Objects as manila folders,
classes as file drawers.
(blecture doc ppt.pdf)
Reading: Gries/Gries, Sections 1.3.1–1.3.2, pp. 30–32.
Learn what a class and an object are, through an analogy. The analogy abstracts away from the computer, hiding unnecessary details and making the concepts easier to understand. Later, you can learn something about how these concepts are implemented in the machine itself. But for now, the emphasis is on ease of understanding.
  Self-help exercises: Drawing objects
2. Creating and referencing objects.
(blecture doc ppt.pdf)
Reading: Gries/Gries, Section 1.3.3, pp. 33–39.
Learn about the type of object names for a class, how to reference a component (method or field) of an object, and the Java expression for creating an object.
  Self-help exercises: Evaluating new-expressions
3. Class JFrame.
(blecture  doc)
Reading: Gries/Gries, Section 1.3.1, pp. 19–20.
Watch execution of statements that create objects and save their names in variables and execution of calls on methods in those objects, using an object of class JFrame, which is associated with a window on your monitor.
4. Packages and the import statement.
(blecture  doc)
Reading, Gries/Gries, Sec. 11.1, pp 327–331.
Learn that a package is a bunch of classes that are stored in a particular place. "Importing" them makes it easier to refer to them.
6. Lab 2: Playing with JFrames. Lab 2 guides you through several activities dealing with JFrames and subclasses of them. You will also learn about another class, Dimension, and will get guidance on looking at the API packages. Do this on your own, if you want to show the results to a consultant to make sure you did everything right, they will be happy to talk to you.