What is the difference between a class and an object?
A class is a blueprint; an object is an instance created from that class.
What is the purpose of a constructor?
To initialize instance variables when an object is created.
What does the private keyword do?
Makes sure that only the methods that belong to the class can access the variable.
Why is using multiple classes helpful in a program?
It improves modularity, readability, and maintainability
Which TV show holds the record for the most Emmy wins of all time?
Saturday Night Live
What type of variable belongs to each individual object created from a class?
Instance variable.
What is the difference between a constructor parameter and an instance variable?
Parameters receive values from a Constructor call; instance variables store data for the object.
Constructors usually use the value from parameters to instantiate instance variables.
Why are instance variables usually declared private?
To protect data from being directly access; they can only be accessed by getter or setter methods.
What happens when an object is passed into a method as a parameter?
The method can modify the original object.
What film won the first Academy Award for Best Animated Feature in 2002?
Shrek
What is a static variable?
A variable shared by all objects of a class.
When is a no-parameter constructor valid?
When a class has NO written constructor, or when a class has a manually created no-parameter constructor
What is encapsulation?
Restricting direct access to data while providing controlled access through methods.
What does it mean when a method returns an object?
It returns a reference to the object, not a copy.
What ancient civilization built the city of Machu Picchu?
The Inca
Where can a local variable be declared and used?
Inside a method, a constructor, or a control structure.
When is a no-parameter constructor NOT automatically available?
When a class defines a constructor with parameters.
What types of variables can instance methods modify?
Both instance and static
What is the best practice when an object is passed into a Constructor as a parameter to be assigned to an instance variable?
Do not use the direct value of the Constructor. Instead, make a new copy of the Object and assign the copy to the instance variable.
What is the only letter that does not appear in the periodic table of elements?
J
Why can local variables never be declared private or public?
Access modifiers apply only to class-level variables (instance or class), not method-level variables.
Local variables ONLY exist within their scope and cannot be accessed outside of a class no matter what.
What keyword is used to distinguish instance variables from parameters with the same name?
The "this" keyword
What can a static (class) method NOT access directly?
Instance variables or instance methods
Why can changes made to an object inside a method still be seen outside the method?
Because the reference points to the same object in memory.
What is the term for the fear of long words? (Closest spelling wins)
Hippopotomonstrosesquipedaliophobia