• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/68

Click to flip

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;

68 Cards in this Set

  • Front
  • Back
helps hide implementation behind an interface (or API)
encapsulation
___ code has two features
instance variables are kept protected (usually with the private modifier)
getter and setter methods provide access to instance variables
encapsulated
IS-A refers to ___
inheritance
IS-A is expressed with the keyword ___
extends
IS-A, ___, ___ are all equivalent expression
inherits from, is a subtype of
HAS-A means an instance of one class ___
"has a" reference to an instance of another class or another instance of the same class
allows a class to be a subclass of a superclass, and thereby inherit public and protected variables and methods of the superclass
inheritance
___ is a key concept that underlies IS-A, polymorphism, overriding, overloading, and casting
inheritance
all classes are subclasses of type ___, and therefore inherit its methods
Object
___ means many forms
polymorphism
a reference variable is always of a single, unchangeable type, but it can refer to a ___ ___
subtype object
a single object can be referred to by reference variables of many different types - as long as ___
they are the same type or a subtype of the object
the ___ (not the object's type) determines which methods can be called
reference variable's type
polymorphic method invocations apply only to overridden ___
methods
methods can be overridden or overloaded; constructors ___
can be overloaded but not overridden
___ methods must be overridden by the first concrete subclass
abstract
with respect to the method it overrides, the overridding method
must have the same argument list
must have the same return type or a subclass (covariant return)
must not have a more restrictive access modifier
may have a less restrictive access modifier
must not throw new or broader checked exceptions
may throw fewer or narrower checked exceptions or any unchecked exception
___ methods cannot be overridden
final
only ___ methods may be overridden
inherited, and remember that private methods are not inherited
a subclass uses ___.___ to call the superclass version of an overridden method
super.overriddenMethod()
___ means reusing a method name, but with different arguments
overloading
overloading methods
must have different argument lists
may have different return types, if argument lists are also different
may have different access modifiers
may throw different exceptions
methods from a superclass ___ be overloaded in a subclass
can
___ applies to overriding, not to overloading
polymorphism
___ determines which overridden method is used at runtime
object type
___ determines which overloaded method will be used at compile time
reference type
two types of reference variable casting
downcasting and upcasting
if you have a reference variable that refers to a subtype object, you can assign it to a reference variable of the subtype. you must make an explicit cast to do this, and the result is that you can access the subtype's members with this new reference variable
downcasting
when you implement an ___, you are fulfilling its contract
interface
you implement an ___ by properly and concretely overriding all of the methods defined by it
interface
a single class can implement ___ ___
many interfaces
overloaded methods can change return type; overridden methods ___
cannot, except in the case of covariant returns
object reference return types cannot accept ___ as a return value
null
an array is a legal/illegal return type both to declare and return as a value
legal
for methods with ___ ___ ___, any value that can be implicitly converted to the return type can be returned
primitive return types
___ can be returned from a void, but you can return nothing. you're allowed to simply say return in any method with a void type to bust out of a method early. but you can't return nothing from a method with a non-void return type.
nothing
methods with an object reference return type ___ return a subtype
can
methods with an interface return type ___ return any implementer
can
a ___ is always invoked when a new object is created
constructor
each superclass in an object's inheritance tree will have a ___ called
constructor
every class, even an abstract class, has at least one ___
constructor
constructors must have the same name as the ___
class
constructors don't have a ___ ___
return type, if you see a method with the same name as the class with a return type it's not a constructor
typical constructor execution occurs as follows
the constructor calls its superclass constructor which calls its superclass const. and so on
the Object constructor executes and then returns to the calling constructor, which runs to completion and then returns to its calling constructor, and so on back down to the completion of the constructor of the actual instance being created
constructors may use ___ access modifier
any, even private!
the compiler will ___ if you don't create any constructors in your class
create a default constructor
the default constructor is a ___ constructor
no-arg, with a no-arg call to super
the first statement of every constructor must be a call to either ___ or ___
this() (an overloaded constructor) or super()
the compiler will add a call to ___ unless you have already put in a call to this() or super()
super()
instance members are accessible only ___
after the super constructor runs
abstract classes have constructors that are called when ___
a concrete subclass runs
interfaces do/do not have constructors
do not
if your superclass does not have a no-arg constructor, ___
you must create a constructor and insert a call to super() with arguments matching those of the superclass constructor
constructors are never inherited, thus they ___
cannot be overridden
a constructor can be directly invoked only by ___
another constructor (using a call to super() or this())
issues with calls to this()
may appear only as the first statement in a constructor
the argument list determines which overloaded constructor is called
constructors can call constructors can call constructors and so on, but sooner or later one of them better call super() or the stack will explode
calls to this() and super() cannot be in the same constructor. you can have one or the other but never both
use ___ methods to implement behaviors that are not affected by the state of any instances
static
use static variables to hold data that is class specific as opposed to
instance specific-there will be only one copy of a static variable
all static members belong to the ___, not to any instance
class
a ___ method can't access an instance variable directly
static
use the dot operator to access static members, but remember that using a reference variable with the dot operator is really a syntax trick, and the compiler will substitute the class name for the reference variable, for instance
d.doStuff();

becomes

Dog.doStuff();
static methods can't be overridden, but they can be ___
redefined
___ refers to the degree to which one class knows about or uses members of another class
coupling
___ ___ is the desirable state of having classes that are well encapsulated, minimize references to each other, and limit the breadth of API usage
loose coupling
___ ___ is the undesirable state of having classes that break the rules of loose coupling
tight coupling
refers to the degree in which a class has a single, well-defined role of responsibility
cohesion
___ ___ is the desirable state of a class whose members support a single, well-focused role or responsibility
high cohesion
___ ___ is the undesirable state of a class whose members support multiple, unfocused roles or responsibilities
low cohesion