ArrayList - Answers Dynamic array
ArrayList<String> namelist;
nameList = new ArrayList<String>();
Has instance methods:
Add
Get(index)
Size
Varargs (variable argument) - Answers Allows a method to accept zero or multiple arguments
returnTypr MethodName (dataType ... variableName)
... must be included
Can only be one in the argument
Must be the last argument
Inheritance - Answers Using this technique, a very general form of a class is first defined and
complied, and then more specialized versions of the class are defined by adding instance
variables and methods. The new specialized classes automatically have all the instance
variables and methods that the base case has.
Allows code to be reused without copying it into the definition of the derived classes
public class HourlyEmployee extends Employee{...}
, Override - Answers Derived classes can change or "override" inherited methods from the base
class to provide their version of the method
@Override
public double area (double...dimensions) {
}
Overloading - Answers When a method in a derived class has a different signature from the
method in the base class, that is overloading
It still inherits the original method from the base class as well
Final modifiers - Answers If it is placed before the definition of a method, that method may not
be redefined in a derived class, and if it is placed before a class, that class may not be used as a
base class to derive other classes
public final class FinalClass {
}
Polymorphism - Answers Allows changes to be made to method definitions in the derived
classes, and have those changes applied to the software written for the base class
The ability to associate many meanings to one method name
Done through late binding or dynamic binding
Think print description for types of employees
Abstract class - Answers An abstract method has a signature, but no method body. The body of
the method is defined in the derived classes. The class that contains an abstract method is
called an abstract class