Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
29 Cards in this Set
- Front
- Back
inheritance creates what kind of relationship? |
is-a |
|
a subclass has... |
-All characteristics of superclass -adds it own/modifies characteristics |
|
which keyword is used on the class header to define a subclass? |
extends |
|
Members of the superclass that are marked private...
|
– are not inherited by the subclass
|
|
Members of the superclass that are marked public... |
– are inherited by the subclass |
|
Constructors are not... |
inherited.
|
|
The super keyword allows what? |
the superclass constructor to be explicitly called. |
|
Calls to the superclass constructor must be what? |
the first java statement in the subclass constructors. |
|
Can methods in subclasses have the same signature as methods in the super class? |
yes; this is call method overriding. |
|
how can an over ridden superclass method be called? |
with the the super keyword. i.e. super.setScore(rawScore * percentage); |
|
How can a superclass prevent a method from being over ridden? |
the final keyword. i.e. public final void message()
|
|
Protected members of a class... |
-may be accessed by methods in a subclass -may be accessed by methods in the same package as the class |
|
be default the access modifier allows... |
Access to all classes in the same package. |
|
An abstract class... |
-Cannot be instantiated -serves as a super class -place abstract keyword in class definition i.e. public abstract class ClassName |
|
an abstract method... |
- appears in the superclass -expects to be over ridden in the subclass -has only a header and no body -ensures that every concrete subclass implements the method i.e. public abstract void setValue(int value)
|
|
If a class has an abstract method it is? |
an abstract class and must be declared so. |
|
A reference variable is polymorphic because? |
It can reference objects of types different from its own, as long as those types are subclasses of it's type. |
|
dynamic/late binding occurs when? |
A variable contains a polymorphic reference. |
|
dynamic/late binding is? |
When the Java virtual machine determines at runtime which method to call, depending on the type of object that the variable references. -Object type (not reference type) determines which method is called |
|
Can a superclass object ne assigned to a subclass reference variable? |
No |
|
An interface... |
-Cannot be instantiated -all methods listed in interface must be implemented if a class implements the interface. -Specifies behavior for other classes -methods are public by default and have no bodies |
|
How many interfaces can be implemented by a class? |
Any number i.e. public class MyClass implements Interface1, |
|
interface format? |
public interface InterfaceName |
|
How is an interface implemented? |
uses implements keyword i.e. public class FinalExam3 extends GradedActivity implements |
|
In UML diagrams implementation of an interface is shown via what? |
dashed line |
|
Fields in an interface are? |
-Final and static -Must be initialized -any class implementing interface has access to these variables |
|
A reference variable of an interface type... |
-allows any object implementing the interface has access to variable. |
|
When a class implements an interface an inheritance relationship known as what is established? |
interface inheritance |
|
When a reference to an object is a interface variable... |
-Only those methods declared in the interface are available. -Explicit type casting is required to access the other methods |