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;
6 Cards in this Set
- Front
- Back
Rules for overriding a method (6-7)
arg list return type access modifier inheritance requirements exceptions |
1. argument list must match exactly
2. return type must be same or subtype (co-variant) 3. access type can't be more restrictive (can be less restrictive) 4. subclass in same pkg can override public,protected,default subclass in different pkg can override public,protected 5. Can throw any more/broader checked exceptions, can throw any narrower, or unchecked exceptions |
|
Overloading method requirements/options
argument list polymorphism limitation |
Method must have same name and
1. MUST change argument list 2. Overloaded method in subclass is NOT consider if method signature doesn't exist in parent class |
|
What does the term 'encapsulation' imply with respect to instance variables?
|
Instance variables can't be accessed or updated directly, but can only be set through using getters and setters provided in the class where the instance variables are declared
|
|
What Java principle is supported thru the use of the Java beans standard/convention?
|
Encapsulation
|
|
What must be true for the statement A "IS-A" B to be true?
|
A must be a subclass of B, an interface implementation of B, or a subclass of an interface implementation of B.
|
|
What must be true for the statement A "HAS-A" B to be true?
|
Some code in class A must have a reference to an instance of class B
Q?: Does this mean that the reference to class B be must be an instance variable in class A? If a method in class A has a local variable reference to class B would A "HAS-A" B still be true? (I think not) |