Classes and Objects Flashcards
A high-level, powerful programming language that
uses the Object-Oriented Programming (OOP)
approach.
Java
A programming style that models real-world entities as “objects.”
Object-Oriented Programming (OOP)
Objects have: (mention 2)
Data (fields): Information or attributes.
Behavior (methods): Actions or functions.
Objects have:
Data (fields): ______________
Behavior (methods): _____________
Data: Information or attributes.
Behavior: Actions or functions.
Programs are written as step-by-step instructions or
functions.
Traditional Programming (Procedural)
What is a Class?
A class is like a blueprint or template for creating
objects.
Mention two Variables in a Class:
Instance Variables
Class Variables
What type of variable is this in a class?
* Declared inside a class but outside any method.
* Non-static and unique to each object.
Instance variables
What type of variable is this in a class?
* Declared with the static keyword.
* Shared across all objects of the class.
Class variables
An ________ is a real-world entity created from a class.
object
If a ______ is a blueprint, an object is the actual
product made from that blueprint.
class
The process of creating an object
from a class.
Instantiation
___________ are the characteristics or properties of
an object.
Attributes
Attributes are also called ________ or ________
variables.
fields or instance
variables.
Do attributes belong to a class? True or false
True
Each object has its own copy of class
variables. True or false
False
Each object has its own copy of instance
variables not class variables.
_________ variables are specific to an object
and can only be accessed within that
object.
Instance
Java reserves ________ for the object based on the class blueprint.
memory
The name of the class.
ClassName
The name of the object (instance).
objectName
This keyword allocates memory for the object.
new
Calls the class constructor to initialize the object.
ClassName()
We can create ___________ attributes (which belong to individual objects) and ________ attributes (which belong to the class itself)
non-static , static
To access the attributes of a class, we create an ________ and use _____________.
object , dot notation (.)