CORRECT Answers
wrapper class - CORRECT ANSWER - object class for a primitive, in java.lang package,
Integer.parseInt()
inheritance - CORRECT ANSWER - supports software reuse, parent class (super class/
base class) and child class (sub class), child classes can inherit public or protected variables and
methods, extends, super (call parent constructor and methods), is relationship, (triangle in UML)
protected visibility modifier - CORRECT ANSWER - can be inherited, can be accessed
by any class in the same package (# in UML)
public visibility modifier - CORRECT ANSWER - inherited, can be accessed from
anywhere (+ in UML)
private visibility modifier - CORRECT ANSWER - not inherited (- in UML)
multiple inheritance - CORRECT ANSWER - not in java, multiple parent classes
overriding - CORRECT ANSWER - child redefines an inherited method, method with
final cannot be overridden, methods in different classes, different object types
final - CORRECT ANSWER - variables, methods, and classes can be final, String class is
final
overloading - CORRECT ANSWER - multiple methods with the same name in the same
class but different parameters
, abstract class - CORRECT ANSWER - no instantiated objects, contains one or more
abstract methods, can contain non-abstract methods, child class has to define abstract methods,
italic in UML
abstract method - CORRECT ANSWER - method header without a method body, cannot
be final or static, can be in a non-abstract class, italic in UML, ends in semicolon
class hierarchies - CORRECT ANSWER - ex) bat inherits from mammal and animal
widening conversion - CORRECT ANSWER - assigning a predecessor object to an
ancestor reference. ex)bat can be of type mammal
narrowing conversion - CORRECT ANSWER - assigning an ancestor object to a
predecessor reference. Requires a cast. ex)if bat was declared as a mammal, saving it as a bat
requires a cast
designing for inheritance - CORRECT ANSWER - inheritance relationships affect
elegance, maintainability, and reuse of software, is-a relationship, put common characteristics
higher in hierarchy, override methods as appropriate (always toString and equals), don't redefine
inherited variables (shadow or overshadow), allow each class to manage its own data(super), use
abstract classes to represent general concepts used several times, use visibility modifiers
appropriately
designing software - CORRECT ANSWER - take time to create, less time to maintain
restricting inheritance - CORRECT ANSWER - final restricts inheritance, abstract cannot
be final, key design decision
polymorphic reference - CORRECT ANSWER - reference variable that can refer to
different types of objects at different points in time, resolved in run-time, uses the same method
name but call different classes in the hierarchy