What does OOP stand for?
Object-Oriented Programming
What is a class?
A blueprint or template for creating objects
When you use a class written by someone else, what is your program called?
A client
What are instance variables also called?
Fields
What is an instance method?
A method that operates on a specific object
In OOP, what do we organize our code around instead of only functions?
Objects
What is an object (or instance)?
A specific version created from a class
What is data encapsulation?
Keeping implementation details hidden from the user
What is the purpose of a constructor?
To create objects and initialize instance variables
What keyword is commonly used to restrict access to instance variables?
private
What two main components does every object have?
State and behavior
What does it mean to instantiate a class?
To create an object from a class
Why don’t clients need to know how a method works internally?
Encapsulation allows users to focus on what a method does
What happens if you don’t write a constructor in Java?
Java provides a no-argument constructor
What is the general format of an instance method?
visibility returnType methodName(parameters)
Give one example of state and one example of behavior for a Rectangle object.
State: width or height; Behavior: calculating area
Why is a class often compared to a blueprint?
It defines how objects are built but is not the object itself
In documentation, what does the Constructor Summary tell you?
How to create objects
Why does each object get its own copy of instance variables?
Each object represents separate data
What is the difference between a getter and a setter?
A getter reads; a setter updates
Why is Object-Oriented Programming useful compared to only writing functions?
It organizes code around objects, making code easier to manage and reuse
Identify which is a class and which is an object: Student and student1.
Student is a class; student1 is an object
How does the bank example relate to abstraction in programming?
You use services without knowing internal details
What is the purpose of the toString() method?
To return a readable String representation of an object
Give two reasons why getters and setters are used instead of public variables.
Validation, safety, abstraction