Guided Notes

Classes & Objects

Classes and objects, attributes and methods, constructors, this, access modifiers, encapsulation, and packages.

Classes and objects

Slide 1 / 5

Object-oriented programming (OOP) models programs as objects that combine data and behavior.

β€’ A class is a blueprint: it defines what data (attributes) and behavior (methods) its objects have. β€’ An object is one instance created from the class.

class Car { … } is the blueprint; new Car("Volvo", 2024) and new Car("BMW", 2021) are two separate objects, each with its own data.

OOP makes code reusable and keeps related code together.

← Methods