1/18
Looks like no tags are added yet.
What is an object?
Something that has both state and behavior.
What are classes?
A template for creating an object.
What is an instance?
A specific version of a class. Instances and objects generally refer to the same thing.
What is the case difference between classes, objects, and instances?
Class names are capitalized (types).
When you create a specific version (instance/object), it’s lowercase.
What sentence relates classes, instances, and objects?
“An object is an instance of a class.”
What does it mean to be a client of the class?
When someone else creates a class and you can use the functionality of that class.
What is an instance variable?
A variable defined in a class for which each object of the class has its own copy, or instance
What are constructors?
A constructor allows us to create a new instance of a class, usually initializing instance variables.
What is an instance method?
An instance method is piece of code called on a specific instance of the class. It is called with a receiver object.
What is the general form of a method?
visibility returnType name(parameters)
What is the general form of calling an instance method?
receiver.methodName(parameters)
What are the two things that an object has?
State and behavior
What are getter methods / accessor methods used for?
They let you get access to some instance variables of an object.
What are setter methods / modifier methods used for?
They let you set the values of instance variables of an object.
What is a class variable?
A variable or attribute of a class common to all instances of a class.
What is a class method?
A method of a class common to all instances of a class, and is not called on an object instance.
Which of these is an example of calling a static method?
a) point.setX(x)
b) Math.abs(x)
c) student.getName()
d) square(x)
Math.abs(x)
What is method overloading?
Methods in a class can have the same name as long as their parameters are different
For method overloading, how should the method signatures be different?
1) Different types of parameters
2) Different ordering of parameter types
3) Different number of parameters