Term
|
Definition
- Requires different signature
- Parameter list distinguishes one method from the next
|
|
|
Term
|
Definition
- Requires identical signatures
- Correct version is determines by calling object
- Methods can prohibit overriding by using keyword final
public final void message()
|
|
|
Term
|
Definition
- Never instantiated
- Purpose: to serve as a base for other classes
public abstract class MyClass |
|
|
Term
|
Definition
- Specifies behavior for a class
- Cannot be instantiated
- All the methods listed in an interface must be written elsewhere
public interface InterfaceName |
|
|
Term
|
Definition
- If the subclass overrides a method in the superclass and if a superclass variable references a subclass object, and if the superclass reference variable calls the overriden method, the Java will perform dynamic binding
- The correct version of the method will be determined at runtime
|
|
|
Term
|
Definition
- Occurs when the compiler can readily determine the correct version of something during compile time before the program is executed
|
|
|
Term
|
Definition
- Accessible by any other class
|
|
|
Term
|
Definition
- Never directly accessible from outside the class
|
|
|
Term
|
Definition
- Directly accessible by subclasses of the class any any classes in the same package
|
|
|
Term
Difference Between Interface and Abstract Class |
|
Definition
- Methods of a Java interface are implicitly abstract and cannot have implementations. A Java abstract class can have instance methods that implements a default behavior
- Variables declared in a Java interface is by default final. An abstract class may contain non final variables
- Members of a Java interface are public by default. An interface class can have the usual flavors of class members like private, protected, etc
- Interface should be implemented using keyword "implements". Abstract class should be extended using keyword "extends"
- An interface can extend another interface only, an abstract class can extend another class and implements multiple interfaces
- A Java class can implement multiple interfaces but it can extend only one abstract class
- Interface is absolutely abstract and cannot be instantiated; an abstract class also cannot be instantiated, but can be invoked if a main() exists.
- Interfaces are slow
|
|
|
Term
Similarities of Interface and Abstract Class |
|
Definition
|
|
Term
|
Definition
- Refers to an objects superclass
public class SubClass extends SuperClass
{
constructor
public SubClass()
{
super(10);
sout;
}
} |
|
|
Term
|
Definition
- The name of a reference variable that an object can use to refer to itself
public Stock(String symbol, double sharePrice)
{
this.symbol=symbol;
this.sharePrice=sharePrice;
}
or
public Stock(String sym, double price)
{
symbol=sym;
sharePrice=price;
}
public Stock(String sym)
{
this(sym, 0.0);
} |
|
|
Term
|
Definition
- The number of times that a method calls itself
|
|
|
Term
Why Recursion is preferable |
|
Definition
|
|
Term
|
Definition
- Sublist 1, Pivot, Sublist 2
- Once a pivot value has been selected, the algorithm swaps the other values in the array until all the elements on the left sublist are less than the pivot, and all the elements in the right sublist are greater than or equal to the pivot
- Then recursively repeats the procedure on sublist 1, then sublist 2. During this process the sublists are divided up with a pivot
- Repeat from step 1
- page 963
|
|
|
Term
|
Definition
- Divide the unsorted list into two sublists of about half the size.
- Sort each sublist recursively by re-applying the merge sort.
- Merge the two sublists back into one sorted list
|
|
|