Java Inheritance

3 Questions | Total Attempts: 881

Please wait...
Java Quizzes & Trivia

From Chapter 7 of Headfirst java

Questions and Answers
  • 1. 
    I want to make sure no one extends my new class.   What Keyword should I use in the class declaration to do that?
  • 2. 
    What is the difference between method "overloading" and method "overridding"?
    • A. 

      A method overload uses the EXACT same arguments, but allows the return types to vary. A method override allows the arguments to vary, but the return type must be the same.

    • B. 

      A method overload MUST have a different argument list, it can however return anything it wants. A method "override" on the other hand must have the EXACT SAME arguments list, and must return the same type, or a subclass of the type found in the superclass.

  • 3. 
    Method "overloading" is a way to allow a subclass to customize a method found in a superclass.
    • A. 


    • B.