The EVERYTHING Deck Flashcards
...because I'm too lazy to organize them by chapter (36 cards)
Chapter 9: Inheritance
What is inheritance in Java?
the “is-a” relationship between a general superclass and a specialized subclass
Is-a = cat IS A pet, phone IS A device
Chapter 9: Inheritance
Why use inheritance?
makes using specific objects in a large progra easier; streamlines efficiency
Chapter 9: Inheritance
A specialized object has…
all characreristics of the general object, plus additonal ones that make it special
Chapter 9: Inheritance
What is a superclass?
the superior or more general class in a generalization or specialization relationship
Chapter 9: Inheritance
What is a subclass?
a class that extends a suoerclass, inheriting its attributes and behaviors
Chapter 9: Inheritance
What is another name for a superclass?
a parent class
Chapter 9: Inheritance
What is another name for a subclass?
a child class
Chapter 9: Inheritance
What is the interaction between child classes and private members?
the child class is unable to use it
Chapter 9: Inheritance
What is the interaction between child classes and public members?
the child class directly inherits it, as well as other parts of the program it can access
Chapter 9: Inheritance
What is the interaction between child classes and protected members?
The child class can modify data, but only if it shares the same package or subclass
Chapter 9: Inheritance
What is the super
keyword for?
referring to the superclass
Chapter 9: Inheritance
What is a method signature made of?
a name and the parameter list
Chapter 9: Inheritance
What does @Override
do?
Instructs the compiler that the annotated method will override one from a superclass or interface
Chapter 9: Inheritance
What is the final
keyword for?
it’s for constants; prevents overriding of a superclass method in a subclass
Chapter 9: Inheritance
What is the class hierarchy?
The organization of classes in a hierarchal tree, where each parent class is a superclass and each child class is a subclass.
Relates back to inheritance
Chapter 9: Inheritance
Are all Java classes derived from a class named “object”?
Yes.
directly or indirectly, all classes ARE derived from the “object” class
Chapter 9: Inheritance
What does a copy constructor do?
accepts an object of the same class as an argument
Chapter 9: Inheritance
What is polymorphism?
The ability to take many forms. It can also reference objects of differing types, as long as it’s a subclass of its type
Chapter 9: Inheritance
What happens with dynamic binding?
The type of an object isn’t determined until run-time
Chapter 9: Inheritance
What happens with dynamic binding?
The type of an object is determined at some later time
Chapter 9: Inheritance
What is an abstract class?
a class that only exists in a model; used for subclasses to inherit from
Chapter 9: Inheritance
What is an abstract method?
A method with no body; must be overridden
Chapter 10: Exceptions & Advanced File I/O
What is an interfact in Java?
a type with no instance variables; entire made of abstract methods and constants
Chapter 10: Exceptions & Advanced File I/O
Can a class implement multiple interfaces?
Yes