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;
24 Cards in this Set
- Front
- Back
class header
|
public class ToolProxy implements ITool
|
|
instance variable declaration
|
private ITool _currentTool;
|
|
method call
|
this._currentTool.apply.(point)
|
|
Java reserved word
|
public
class private this |
|
argument list
|
within a method
(point) |
|
parameter declaration
|
in the header
(ITool tool) |
|
mutator method
|
public void setTool (ITool tool) {
this._currentTool = tool; } |
|
implementation clause
|
implements ITool
|
|
Suppose Colorable is an interface, that the classes House, canvas and mood are all classes that implement the interface..... is this legal java?
Colorable v1 = new Colorable (); |
no an interface cannot instantiate an interface
|
|
Suppose Colorable is an interface, that the classes House, canvas and mood are all classes that implement the interface..... is this legal java?
Colorable v2 = new Canvas(); |
legal
and interface can instantiate a class |
|
Suppose Colorable is an interface, that the classes House, canvas and mood are all classes that implement the interface..... is this legal java?
Colorable v3 = "Fred"; |
No
string is not a type Colorable there for Colorable cannot instantiate "Fred" |
|
Suppose Colorable is an interface, that the classes House, canvas and mood are all classes that implement the interface..... is this legal java?
Colorable v4 = new House(); |
yes
and interface can implement type house |
|
Suppose Colorable is an interface, that the classes House, canvas and mood are all classes that implement the interface..... is this legal java?
Colorable v5 = new Mood(); |
yes
and interface can implement type mood |
|
- - - >
|
realization
implementation is a relationship between a class and interface |
|
---> (solid line)
|
relationship
between 2 classes or 2 interfaces |
|
what does a type hierarchy allows us to......
|
separate the (declared) type of variable from (actual) type of an object whose reference we stare in the variable
|
|
the difference between type hierarchy vs. class hierarchy
|
type hierarchy can be of class or interface and
class hierarchy is only of class type - unique by root: Object |
|
declared types of the variables determine what?
|
the set of methods we can call
|
|
---> (solid line)
|
Inheritance
generalization |
|
how many number of interfaces can a class implement
|
as many as we want
|
|
how many interfaces can an interface extend ?
|
as many as we want
|
|
a user-defined class extends how many classes
|
only ONE
|
|
what does the line look like
public class C1 implements I1 |
----> dotted line
|
|
what does the line look like
public class C3 extends C2 |
---> solid line
|