CIS 35A: Introduction to Java Programming

Home | Green Sheet | Lectures | Assignments | FAQ | Grades

Classes

Objects and Classes
Introduction
OOP Programming Concepts

Object-oriented programming (OOP) involves programming using objects. An object represents an entity in the real world that can be distinctly identified. For example, a student, a desk, a circle, a button, and even a loan can all be viewed as objects. An object has a unique identity, state, and behaviors. The state of an object consists of a set of data fields (also known as properties) with their current values. The behavior of an object is defined by a set of methods.

An object has both a state and behavior. The state defines the object, and the behavior defines what the object does.

Classes are constructs that define objects of the same type. A Java class uses variables to define data fields and methods to define behaviors. Additionally, a class provides a special type of methods, known as constructors, which are invoked to construct objects from the class.

Simplified methodology

  1. Write down detailed description of problem
  2. Identify all (relevant) nouns and verbs
  3. From list of nouns, select objects
  4. Identify data components of each object
  5. From list of verbs, select operations

Previous | OOP Programming Concepts | Use | Encapsulation | Relationship between a class and its object | Next