1/17
Definitions blank out the Term. Multiple blanks do not mean multiple terms; it is the same term blanked out multiple times.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Object
____ do the action in an ____-oriented program. An ____ can have things it knows (attributes) and things it can do (methods). An ____ is created by a class and keeps a reference to the class that created it.
Class
A ____ defines what all objects of that ____ know (attributes) and can do (methods). You can also have data and behavior in the object that represents the ____ (____ instance variables and methods). All objects of a ____ have access to ____ instance variables and ____ methods, but these can also be accessed using ____Name.variable
or ____Name.method()
.
Inheritance
One class can use ____ to acquire the object instance variables and methods from another. This makes it easy to reuse another class by extending it (using ____ from it). This is called specialization. You can also pull out common instance variables and/or methods from several related classes and put those in a common parent class. This is called generalization.
Polymorphism
The runtime type of an object can be that type or any subclass of the declared type. All method calls are resolved starting with the class that created the object. If the method isn’t found in the class that created the object, then it will look in the parent class and keep looking up the inheritance tree until it finds the method. The method must exist, or the code would not have compiled.
Parent class
One class can inherit from another and the class that it is inheriting from is this. The ____ is specified in the class declaration using the extends
keyword followed by the ____ name.
Child class
The class that is doing the inheriting. It inherits access to the object instance variables and methods in the parent class.
Subclass
A child class is also called this.
Superclass
A parent class is also called this.
Declared type
The type that was used in the declaration. list aList = new ArrayList()
has a ____ of List
. This is used at compile time to check that the object has the methods that are being used in the code.
Run-time type
The type of the class that created the object. List aList = new ArrayList()
has a ____ of ArrayList
. This is used at run-time to find the method to execute.
Overrides
A method in a child class can have the same method signature (method name and parameter list) as a method in the parent class. Since methods are resolved starting with the class that created the object, that method will be called instead of the inherited parent method, meaning the child method ____ the parent method.
Overload
Two or more methods with the same name but different parameter lists. The parameter lists can differ by the number or types of parameters.
Getter
A method that returns the value of an instance variable in an object.
Setter
A method that sets the value of an instance variable in an object.
Accessor
Another name for a getter method — one that returns the value of an instance variable.
Mutator
Another name for a setter method — one that changes the value of an instance variable.
Extends
Used to specify the parent class to inherit from. It is followed by the name of the parent class, like this: public class ChildName extends ParentName
. If no extends
keyword is used in the class declaration, then the class will automatically inherit from the Object class.
Static
Keyword used to indicate that an instance variable or method is part of the class and not part of each object created by the class.